writeToFs(t, fs, "layouts/partials/partial.html", `
Partial Page: {{ .Params.COLOR }}|{{ .Params.Colors.Blue }}
Partial Site: {{ .Site.Params.COLOR }}|{{ .Site.Params.COLORS.YELLOW }}
+Partial Site Global: {{ site.Params.COLOR }}|{{ site.Params.COLORS.YELLOW }}
`)
writeToFs(t, fs, "config.toml", caseMixingSiteConfigTOML)
"Shortcode Site: green|yellow",
"Partial Page: red|heavenly",
"Partial Site: green|yellow",
+ "Partial Site Global: green|yellow",
"Page Title: Side 1",
"Site Title: Nynorsk title",
"«Hi»", // angled quotes
"ByWeight": fmt.Sprintf("%v:%v:%v", seq, key, args),
}, nil
},
+ "site": func() interface{} {
+ return map[string]interface{}{
+ "Params": map[string]interface{}{
+ "lower": "global-site",
+ },
+ }
+ },
}
paramsData = map[string]interface{}{
{{ $_x := $.Params.MyDate | ToTime }}
PARAMS TIME2: {{ $_x.AddDate 0 1 0 }}
+
+PARAMS SITE GLOBAL1: {{ site.Params.LOwER }}
+{{ $lower := site.Params.LOwER }}
+{{ $site := site }}
+PARAMS SITE GLOBAL2: {{ $lower }}
+PARAMS SITE GLOBAL3: {{ $site.Params.LOWER }}
`
)
require.Contains(t, result, "PARAMS TIME: 1972-02-28")
require.Contains(t, result, "PARAMS TIME2: 1972-02-28")
+ // Issue ##5615
+ require.Contains(t, result, "PARAMS SITE GLOBAL1: global-site")
+ require.Contains(t, result, "PARAMS SITE GLOBAL2: global-site")
+ require.Contains(t, result, "PARAMS SITE GLOBAL3: global-site")
+
}
func BenchmarkTemplateParamsKeysToLower(b *testing.B) {