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

Wrong .Parent with pages with overlapping names (e.g. sdk and sdk_exporters) #12263

Closed
jmooring opened this issue Mar 15, 2024 · 2 comments · Fixed by #12265
Closed

Wrong .Parent with pages with overlapping names (e.g. sdk and sdk_exporters) #12263

jmooring opened this issue Mar 15, 2024 · 2 comments · Fixed by #12265

Comments

@jmooring
Copy link
Member

jmooring commented Mar 15, 2024

The issue title is a big vague for now.

Reference: https://discourse.gohugo.io/t/subpage-missing-from-sections-page-list-when-using-0-123-8/48789

Minimal reproducible example:

git clone --single-branch -b hugo-forum-topic-48789 https://github.com/jmooring/hugo-testing hugo-forum-topic-48789
cd hugo-forum-topic-48789
npm ci
hugo server

Then visit http://localhost:1313/docs/logs/ to see the problem.

You will see "Stdout" in the menu on the left, but that page is not shown in the content listing with v0.123.0 or later.

@bep bep changed the title Link missing when rendering site with v0.123.0 and later Wrong .Parent with pages with overlapping names (e.g. sdk and sdk_exporters) Mar 15, 2024
@bep bep self-assigned this Mar 15, 2024
@bep bep removed the NeedsTriage label Mar 15, 2024
@bep bep added this to the v0.124.0 milestone Mar 15, 2024
@bep
Copy link
Member

bep commented Mar 15, 2024

I have a fix on its way, but I would recommend the theme author(s) to somehow simplify this construct:

{{ $parent := .Page -}}
    {{ $pages := (where .Site.Pages "Section" .Section).ByWeight -}}
    {{ $pages = (where $pages "Type" "!=" "search") }}
    {{ $pages = (where $pages ".Params.hide_summary" "!=" true) -}}
    {{ $pages = (where $pages ".Parent" "!=" nil) -}}
    {{ if and $parent.File .Parent .Parent.File -}}
        {{ $pages = (where $pages "Parent.File.UniqueID" "==" $parent.File.UniqueID) -}}
    {{ end -}}

Copy link

github-actions bot commented Apr 7, 2024

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 Apr 7, 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.

2 participants