mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
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:
@@ -1166,6 +1166,7 @@ enable = false
|
||||
c4u = false
|
||||
|
||||
# Page config
|
||||
# TODO migrate mapping key to `params` layer in the future
|
||||
[params.page]
|
||||
# FixIt 0.2.18 | NEW whether to enable the author's avatar of the post
|
||||
authorAvatar = true
|
||||
|
||||
@@ -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 -}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{- /* Hook for code blocks rendering */ -}}
|
||||
{{- $config := .Attributes | merge (.Page.Param "codeblock") -}}
|
||||
{{- $config := .Attributes | merge .Page.Params.codeblock | merge .Page.Site.Params.codeblock -}}
|
||||
{{- $result := transform.HighlightCodeBlock . -}}
|
||||
{{- $wrapper := $result.Wrapped -}}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- $rvc := .Page.Param "repoVersion" -}}
|
||||
{{- $rvc := .Page.Params.repoVersion | merge .Page.Site.Params.repoVersion -}}
|
||||
{{- $version := .Get 0 -}}
|
||||
{{- $type := .Get 1 | default "new" | lower -}}
|
||||
{{- $label := T (printf "version.%v" $type) | default (upper $type) -}}
|
||||
|
||||
Reference in New Issue
Block a user