Thanks to visit codestin.com
Credit goes to github.com

Skip to content

tpl/tplimpl: Use AllTranslations in sitemap#14917

Closed
sjh9714 wants to merge 1 commit into
gohugoio:masterfrom
sjh9714:fix-sitemap-all-translations
Closed

tpl/tplimpl: Use AllTranslations in sitemap#14917
sjh9714 wants to merge 1 commit into
gohugoio:masterfrom
sjh9714:fix-sitemap-all-translations

Conversation

@sjh9714
Copy link
Copy Markdown

@sjh9714 sjh9714 commented May 19, 2026

Summary

Fixes the embedded sitemap template alternate-link block to use .AllTranslations for translated pages.

What changed

  • Updated the sitemap template to range .AllTranslations inside the existing .IsTranslated guard.
  • Added a regression test covering a translated page where the current language link should be emitted before the translated language link.

Why

The previous template ranged .Translations and then manually appended the current page. That produced the right set of links, but it duplicated the behavior that .AllTranslations already provides and made the current-language entry come from a separate code path. Keeping .IsTranslated preserves the existing behavior for single-language sites.

Testing

  • Before the template change, go test ./hugolib -run TestSitemapMultilingualAlternateLinksUseAllTranslations -count=1 failed because the current language link was emitted after the translated language link.
  • go test ./hugolib -run TestSitemapMultilingualAlternateLinksUseAllTranslations -count=1
  • go test ./hugolib -run 'TestSitemap' -count=1
  • git diff --check
  • PATH="$(go env GOPATH)/bin:$PATH" ./check.sh ./hugolib
  • PATH="$(go env GOPATH)/bin:$PATH" ./check.sh ./tpl/tplimpl

I also ran PATH="$(go env GOPATH)/bin:$PATH" ./check.sh; it passed gofmt and staticcheck, then failed in hugolib/pagesfromdata because local external converters were missing (asciidoctor; with warnings for missing pandoc and rst2html).

Fixes #14912

Note: I used Codex to help inspect the issue, prepare the narrow fix, and run local verification; I reviewed the final diff and the listed command results before opening this PR.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 19, 2026

CLA assistant check
All committers have signed the CLA.

@gemini-code-assist
Copy link
Copy Markdown

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

@bep bep closed this in 6475d30 May 21, 2026
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.

The sitemap.xml link sections looks odd

2 participants