key = refs[1]
}
- key = filepath.ToSlash(key)
- if !strings.HasPrefix(key, "/") {
- key = "/" + key
- }
-
return c.getPage(nil, key)
}
var doSimpleLookup bool
if isReflink || context == nil {
slashCount := strings.Count(inRef, "/")
- if slashCount <= 1 {
- doSimpleLookup = slashCount == 0 || ref[0] == '/'
- }
+ doSimpleLookup = slashCount == 0
}
if !doSimpleLookup {
b.AssertFileContent("public/s1/p2/index.html", "p1")
}
+func TestGetPageNewsVsTagsNewsIssue12638(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+disableKinds = ['rss','section','sitemap']
+[taxonomies]
+ tag = "tags"
+-- content/p1.md --
+---
+title: p1
+tags: [news]
+---
+-- layouts/index.html --
+/tags/news: {{ with .Site.GetPage "/tags/news" }}{{ .Title }}{{ end }}|
+news: {{ with .Site.GetPage "news" }}{{ .Title }}{{ end }}|
+/news: {{ with .Site.GetPage "/news" }}{{ .Title }}{{ end }}|
+
+`
+
+ b := Test(t, files)
+
+ b.AssertFileContent("public/index.html",
+ "/tags/news: News|",
+ "news: News|",
+ "/news: |",
+ )
+}
+
func TestGetPageBundleToRegular(t *testing.T) {
files := `
-- hugo.toml --