fix: dict type page parameters fall back to site parameters using merge behavior (#670)

> The `Param` method on a `Page` object looks for the given `KEY` in page parameters, and returns the corresponding value. If it cannot find the `KEY `in page parameters, it looks for the `KEY` in site parameters. If it cannot find the `KEY` in either location, the Param method returns `nil`.
>
> See: https://gohugo.io/methods/page/param/

So `.Page.Param` is only suitable for simple types.
This commit is contained in:
Cell
2025-12-30 11:23:25 +08:00
committed by GitHub
parent 26dc22ba16
commit d55d53741d
4 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
{{- $jsonViewer := .Attributes | merge (.Page.Param "jsonViewer") -}}
{{- $jsonViewer := .Attributes | merge .Page.Params.jsonViewer | merge .Page.Site.Params.jsonViewer -}}
{{- if $jsonViewer.enable -}}
{{- $attrs := printf `expand-depth="%v"` $jsonViewer.expanddepth -}}
{{- $copyable := false -}}