Skip to content

Page resource not available when containing directory name partially matches another directory #13228

Closed
@jmooring

Description

Reference: https://discourse.gohugo.io/t/page-resources-of-index-pages-missing/53053

This is somewhat similar to: #12465

content/
├── s1/
│   └── _index.md
├── s1x/
│   └── a.txt
└── _index.md

In the above, content/s1x/a.txt should be a page resource for content/_index.md. But it isn't because the s1x directory name starts with s1.

Failing test

func TestFoo(t *testing.T) {
	t.Parallel()

	files := `
-- hugo.toml --
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
-- content/_index.md --
---
title: home
---
-- content/s1/_index.md --
---
title: s1
---
-- content/s1x/a.txt --
a.txt
-- layouts/index.html --
{{ range .Resources.Match "**" }}
  {{ .Name }}|
{{ end }}
`

	b := hugolib.Test(t, files)

	b.AssertFileContent("public/index.html", "s1x/a.txt|")
}

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions