mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
1aacfced39
commit
39cf906bc0
2 changed files with 29 additions and 0 deletions
|
@ -494,3 +494,27 @@ disableKinds = ['home','section','rss','sitemap','taxonomy','term']
|
||||||
|
|
||||||
b.AssertFileExists("public/s-1.2.3/p-4.5.6/index.html", true)
|
b.AssertFileExists("public/s-1.2.3/p-4.5.6/index.html", true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestPagesFromGoParamsIssue12497(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
files := `
|
||||||
|
-- hugo.toml --
|
||||||
|
disableKinds = ['home','section','rss','sitemap','taxonomy','term']
|
||||||
|
-- content/_content.gotmpl --
|
||||||
|
{{ .AddPage (dict "path" "p1" "title" "p1" "params" (dict "paraM1" "param1v" )) }}
|
||||||
|
{{ .AddResource (dict "path" "p1/data1.yaml" "content" (dict "value" "data1" ) "params" (dict "paraM1" "param1v" )) }}
|
||||||
|
-- layouts/_default/single.html --
|
||||||
|
{{ .Title }}|{{ .Params.paraM1 }}
|
||||||
|
{{ range .Resources }}
|
||||||
|
{{ .Name }}|{{ .Params.paraM1 }}
|
||||||
|
{{ end }}
|
||||||
|
`
|
||||||
|
|
||||||
|
b := hugolib.Test(t, files)
|
||||||
|
|
||||||
|
b.AssertFileContent("public/p1/index.html",
|
||||||
|
"p1|param1v",
|
||||||
|
"data1.yaml|param1v",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
|
@ -151,6 +151,11 @@ func (p *PageConfig) Compile(basePath string, pagesFromData bool, ext string, lo
|
||||||
p.Path = path.Join(basePath, p.Path)
|
p.Path = path.Join(basePath, p.Path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if p.Params == nil {
|
||||||
|
p.Params = make(maps.Params)
|
||||||
|
}
|
||||||
|
maps.PrepareParams(p.Params)
|
||||||
|
|
||||||
if p.Content.Markup == "" && p.Content.MediaType == "" {
|
if p.Content.Markup == "" && p.Content.MediaType == "" {
|
||||||
if ext == "" {
|
if ext == "" {
|
||||||
ext = "md"
|
ext = "md"
|
||||||
|
|
Loading…
Reference in a new issue