tpl/tplimpl: Use AllTranslations in sitemap#14917
Conversation
Using Gemini Code AssistThe 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
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 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. |
Summary
Fixes the embedded sitemap template alternate-link block to use
.AllTranslationsfor translated pages.What changed
.AllTranslationsinside the existing.IsTranslatedguard.Why
The previous template ranged
.Translationsand then manually appended the current page. That produced the right set of links, but it duplicated the behavior that.AllTranslationsalready provides and made the current-language entry come from a separate code path. Keeping.IsTranslatedpreserves the existing behavior for single-language sites.Testing
go test ./hugolib -run TestSitemapMultilingualAlternateLinksUseAllTranslations -count=1failed because the current language link was emitted after the translated language link.go test ./hugolib -run TestSitemapMultilingualAlternateLinksUseAllTranslations -count=1go test ./hugolib -run 'TestSitemap' -count=1git diff --checkPATH="$(go env GOPATH)/bin:$PATH" ./check.sh ./hugolibPATH="$(go env GOPATH)/bin:$PATH" ./check.sh ./tpl/tplimplI also ran
PATH="$(go env GOPATH)/bin:$PATH" ./check.sh; it passed gofmt and staticcheck, then failed inhugolib/pagesfromdatabecause local external converters were missing (asciidoctor; with warnings for missingpandocandrst2html).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.