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

Different lookup order for shortcode templates #12792

Open
jmooring opened this issue Aug 23, 2024 · 3 comments
Open

Different lookup order for shortcode templates #12792

jmooring opened this issue Aug 23, 2024 · 3 comments
Assignees
Labels
Milestone

Comments

@jmooring
Copy link
Member

jmooring commented Aug 23, 2024

While updating the related documentation, I thoroughly tested the lookup order for shortcode templates and was surprised by the results. The updated documentation matches the behavior of v0.133.0:

https://gohugo.io/templates/shortcode/#template-lookup-order

This obviously isn't a big problem or we would have heard about it before now.

Testing notes:

git clone --single-branch -b hugo-github-issue-12792 https://github.com/jmooring/hugo-testing hugo-github-issue-12792
cd hugo-github-issue-12792
hugo server
hugo && cat public/en/index.html

Then start removing the shortcode templates one by one, going from most specific to least specific according to:
https://gohugo.io/templates/shortcode/#template-lookup-order

@bep
Copy link
Member

bep commented Aug 23, 2024

and was surprised by the results.

Can you be more ... specific?

@jmooring
Copy link
Member Author

This doesn't look right to me:
https://gohugo.io/templates/shortcode/#template-lookup-order

But it matches current behavior.

@bep
Copy link
Member

bep commented Aug 23, 2024

This doesn't look right to me

That wasn't what I meant about ... more specific. OK, I assume you then also mean that it's different from other templates (e.g. render hooks).

Shortcodes has its own lookup function for technical reasons that's no longer (as) valid. We could/should rewrite this to use the same logic used elsewhere.

@bep bep changed the title Unexpected lookup order for shortcode templates Different lookup order for shortcode templates Aug 23, 2024
@bep bep removed the NeedsTriage label Aug 23, 2024
@bep bep self-assigned this Aug 23, 2024
@bep bep modified the milestones: v0.133.0, Unscheduled Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants