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

.Page.GetPage from within a page bundle is unable to find another page if extension included in target #12120

Closed
jmooring opened this issue Feb 22, 2024 · 1 comment · Fixed by #12125

Comments

@jmooring
Copy link
Member

jmooring commented Feb 22, 2024

content/
└── s1/
    ├── p1/
    │   └── index.md   <-- .Page.GetPage "p2.md" from here fails **
    └── p2.md          <-- .Page.GetPage "p1" from here works

** But .Page.GetPage "p2" (no extension) works

failing test cast
func TestFoo(t *testing.T) {
	t.Parallel()

	files := `
-- hugo.toml --
disableKinds = ['home','rss','section','sitemap','taxonomy','term']
-- content/s1/p1/index.md --
---
title: p1
layout: p1
---
-- content/s1/p2.md --
---
title: p2
layout: p2
---
-- layouts/_default/p1.html --
{{ (.GetPage "p2.md").Title }}|
-- layouts/_default/p2.html --
{{ (.GetPage "p1").Title }}|
`

	b := hugolib.Test(t, files)
	b.AssertFileContent("public/s1/p1/index.html", "p2") // failing test
	b.AssertFileContent("public/s1/p2/index.html", "p1")
}

Reference: https://discourse.gohugo.io/t/hugo-0-123-0-1-breaks-page-getpage/48403

Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@jmooring @bep and others