Closed jmooring closed 4 weeks ago
Given that page /s2/p2 was created by a content adapter:
/s2/p2
{{ (site.GetPage "/s2/p2").Title }} --> p2 (pass) {{ (site.GetPage "p2").Title }} --> "" (fail)
In comparison, when /s1/p1 is backed by a file:
/s1/p1
{{ (site.GetPage "/s1/p1").Title }} --> p1 (pass) {{ (site.GetPage "p1").Title }} --> p1 (pass)
Test case:
func TestFoo(t *testing.T) { t.Parallel() files := ` -- hugo.toml -- disableKinds = ['rss','section','sitemap','taxonomy','term'] -- layouts/index.html -- Test A: {{ (site.GetPage "/s1/p1").Title }} Test B: {{ (site.GetPage "p1").Title }} Test C: {{ (site.GetPage "/s2/p2").Title }} Test D: {{ (site.GetPage "p2").Title }} -- layouts/_default/single.html -- {{ .Title }} -- content/s1/p1.md -- --- title: p1 --- -- content/s2/_content.gotmpl -- {{ .AddPage (dict "path" "p2" "title" "p2") }} ` b := hugolib.Test(t, files) b.AssertFileExists("public/s1/p1/index.html", true) b.AssertFileExists("public/s2/p2/index.html", true) b.AssertFileContent("public/index.html", "Test A: p1", "Test B: p1", "Test C: p2", "Test D: p2", // fails ) }
Reference: https://discourse.gohugo.io/t/site-getpage-does-not-get-pages-created-with-an-adapter/50099/
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Given that page
/s2/p2
was created by a content adapter:In comparison, when
/s1/p1
is backed by a file:Test case:
Reference: https://discourse.gohugo.io/t/site-getpage-does-not-get-pages-created-with-an-adapter/50099/