-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cascade property affects the next page with similar name #12465
Comments
This problem was introduced in v0.123.0. Failing test: func TestFoo(t *testing.T) {
t.Parallel()
files := `
-- hugo.toml --
disableKinds = ['home','rss','sitemap','taxonomy','term']
-- layouts/_default/list.html --
{{ .Title }}
-- layouts/_default/single.html --
{{ .Title }}
-- content/s/_index.md --
---
title: s
cascade:
_build:
render: never
---
-- content/s/p1.md --
---
title: p1
---
-- content/sx/_index.md --
---
title: sx
---
-- content/sx/p2.md --
---
title: p2
---
`
b := hugolib.Test(t, files)
b.AssertFileExists("public/s/index.html", false)
b.AssertFileExists("public/s/p1/index.html", false)
b.AssertFileExists("public/sx/index.html", true) // failing
b.AssertFileExists("public/sx/p2/index.html", true) // failing
} |
You can work around this by removing the cascade from matter, and specify the cascade in your site configuration instead:
This will suppress rendering of all pages in the given section, including the section page itself. |
@mapangalee a progress will be indicated by e.g. a PR referencing this issue or that this issue is marked as closed/solved. Please don't edit your comment to make the notification to reappear in my feed. While that technically works, it's not particulary motivating. |
What version of Hugo are you using (
hugo version
)?Tested versions:
Hugo extended windows-amd64 versions 0.123.0 - 0.125.6
Does this issue reproduce with the latest release?
Yes
Bug description
Cascade property affects the next page with similar name.
We use cascade in one of our pages (/team) to prevent rendering its children separately. But the cascade property affects the next following page (/teams).
File setup
/content
├ /de
│├ /...
│├ /team (List of our employees)
││├ /employee_1
│││└ index.md
││├ /...
││└ _index.md
│├ /teams (Articles about Microsoft Teams)
││├ /article_1
│││└ index.md
││├ /...
││└ _index.md
│├ /...
...
Code
/content/de/team/_index.md:
Tests
→ "/xteams" was rendered
→ E.g. cascade properties were added to "/microsoft" and the next page ("microsoft-365") wasn't rendered anymore
Conclusion
Cascade should only affect children of an page.
→ /page/...
But cascade affect every page where the name starts with the name of the page with the cascade properties.
→ /page...
The text was updated successfully, but these errors were encountered: