•  


Cascade property affects the next page with similar name · Issue #12465 · gohugoio/hugo · GitHub
Skip to content
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

Open
tobias-sundermann opened this issue May 6, 2024 · 2 comments
Open

Cascade property affects the next page with similar name #12465

tobias-sundermann opened this issue May 6, 2024 · 2 comments

Comments

@tobias-sundermann
Copy link

tobias-sundermann commented May 6, 2024

What version of Hugo are you using ( hugo version )?

$ hugo v0.122.0-b9a03bd59d5f71a529acb3e33f995e0ef332b3aa+extended windows/amd64

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:

...
cascade
:
    
_build
:
        
render
: 
never

_build
:
    
render
: 
always

---

Tests

  1. Renaming the folder "/teams" to "/xteams"
    → "/xteams" was rendered
  2. Put the same cascade properties pages where the next page had an similar name
    → 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...

@jmooring
Copy link
Member

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

}

@jmooring
Copy link
Member

jmooring commented May 6, 2024

@tobias-sundermann

You can work around this by removing the cascade from matter, and specify the cascade in your site configuration instead:

[[cascade]]
[cascade.build]
render = 'never'
[cascade._target]
path = '{/s,/s/**}'

This will suppress rendering of all pages in the given section, including the section page itself.

Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
- "漢字路" 한글한자자동변환 서비스는 교육부 고전문헌국역지원사업의 지원으로 구축되었습니다.
- "漢字路" 한글한자자동변환 서비스는 전통문화연구회 "울산대학교한국어처리연구실 옥철영(IT융합전공)교수팀"에서 개발한 한글한자자동변환기를 바탕하여 지속적으로 공동 연구 개발하고 있는 서비스입니다.
- 현재 고유명사(인명, 지명등)을 비롯한 여러 변환오류가 있으며 이를 해결하고자 많은 연구 개발을 진행하고자 하고 있습니다. 이를 인지하시고 다른 곳에서 인용시 한자 변환 결과를 한번 더 검토하시고 사용해 주시기 바랍니다.
- 변환오류 및 건의,문의사항은 juntong@juntong.or.kr로 메일로 보내주시면 감사하겠습니다. .
Copyright ⓒ 2020 By '전통문화연구회(傳統文化硏究會)' All Rights reserved.
 한국   대만   중국   일본