Skip to content

tpl: Fix language handling in partials #13614

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

Merged
merged 1 commit into from
Apr 15, 2025
Merged

Conversation

bep
Copy link
Member

@bep bep commented Apr 15, 2025

We now use the same code path for all templates re this.

Fixes #13612

We now use the same code path for all templates re this.

Fixes gohugoio#13612
@bep bep merged commit d61b9fc into gohugoio:master Apr 15, 2025
6 checks passed
@jmooring
Copy link
Member

We now use the same code path for all templates re this.

Does this mean that partial templates are no longer language and output format agnostic?

@bep
Copy link
Member Author

bep commented Apr 15, 2025

Does this mean that partial templates are no longer language and output format agnostic?

Well, yes and no:

  • Partials gets stored the same way as other templates, but currently with a shallow path. But we use the same language/output format/media type logic as the others.
  • That means that if you ask for mypartial.no.html you will get the "best matching" template based on the same rules as for shortcodes.
  • But there is no "page context" when we look for partial, so e.g. mypartial will not look for "the current output format" -- but we use the values given, e.g. {{ partial "mypartial.no.html" }}.
  • We also don't have a page path, so having partials in layouts/mysection/_partials/mypartial.html doesn't currently make sense, but maybe some day.

@jmooring
Copy link
Member

Thanks for the clarification.

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

Successfully merging this pull request may close these issues.

Partials does not work with multiple languages and RSS
2 participants