Repository navigation
refactor(seo): declare sitemap hreflang alternates in each source - #540
Open
TheMeinerLP wants to merge 1 commit into
Open
TheMeinerLP wants to merge 1 commit into
TheMeinerLP wants to merge 1 commit into
Conversation
The index-page, team and blog-author sitemap sources emitted no alternates of their own. @nuxtjs/sitemap inferred them from sibling entries in the same flat list, so the output was right only as long as both locales stayed in that list. Each source now lists its alternates explicitly, as the blog, project, POI and event sources already do: - index pages list both locales, since every index page exists in each; - team profiles and blog-author pages list only the languages in which the page is listed (a thin profile or an author without a released article in a language is not offered there); - x-default is the en URL, as in the pages' own <head>. The team data has no modification date, so team profiles get no lastmod. Static pages keep none either: no truthful date exists for them. Generated sitemap output keeps the same alternate sets; only the order of the attributes and of the alternates within an entry changed. Claude-Session: https://claude.ai/code/session_01A9Zgvt4WR2zDBkAHaK1FjL
TheMeinerLP
force-pushed
the
fix/sitemap-alternates
branch
from
October 14, 2026 21:05
dfa23d4 to
fa301fa
Compare
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
launchpad | fa301fa | Commit Preview URL Branch Preview URL |
Oct 14 2026, 09:08 PM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The sitemap sources for index pages, team profiles and blog-author pages now declare their hreflang alternates explicitly, the same way the blog, project, POI and event sources already do. Before,
@nuxtjs/sitemapinferred those alternates from sibling entries in one flat list, so the result was right only while both locales stayed in that list.The reported symptom did not reproduce. I checked the live
/__sitemap__/de-DE.xmlanden-US.xml, and a localpnpm build+pnpm previewofmainat 79f10b7: index pages, team profiles and author pages already carriedde-DE,en-USandx-default. The only entry without all three is/de/blog/wer-moechte-plugins-adoptieren, which exists only in German and correctly lists onlyde-DE. So this PR does not repair an observed output bug; it makes the guarantee explicit and tested. That is why the type isrefactor, notfix.Root cause per source
index-pages.ts/indexPageSitemapEntries: the entry carried onlylocandlastmod. The merge with the app's entry kept the app's alternates, so the output was correct, but the source did not state them.team.ts: emitted{ loc }only. Alternates came from the module's sibling inference. Nolastmod, because the team data has no modification date.sinceis a membership year, not a change date, and is absent from the data, so it was not used.blog-authors.ts/blogAuthorSitemapEntries: emitted{ loc, lastmod? }only. Alternates came from the module's inference.lastmodwas already derived from released articles and is kept.events.ts: already explicit (translationKeypairing). Unchanged.Changes
shared/utils/sitemapAlternates.ts(new):localizedAlternates(locales, hrefOf). One alternate per locale where the page exists, plusx-default= en when en is among them.indexPageSitemap.ts: every dated index entry lists all locales, whatever their dates.blogAuthors.ts: alternates only for the languages where the author has a released article.teamProfile.ts:teamSitemapEntries(slugsByLocale); alternates only for the languages where the profile is listed (thin profiles and open positions are excluded, as before).server/api/__sitemap__/team.ts: now a thin wrapper overteamSitemapEntries.No lastmod was added to team profiles or static pages (
/de,/about,/bluemap,/community,/events,/join,/team). No truthful date exists for them in the content, and build time was not used.Before / after XML (
/__sitemap__/de-DE.xml)Index page
/de/blog:Team profile
/de/team/saynax:Author page
/de/blog/author/themeinerlp:Verified on the local preview: all
<url>entries in both files have the expected alternates, no duplicate<loc>, and the German-only article keeps onlyde-DE.Test results
tests/shared/sitemapAlternates.spec.ts,teamProfile.spec.ts,blogAuthors.spec.ts,indexPageSitemap.spec.ts): written red first, then green.pnpm exec vitest run tests/shared tests/seo/team-thin-profiles.spec.ts: 92 passed.pnpm test: 1412 tests pass. 46 test files fail to boot with the same errors as before the change. They are Nuxt-environment suites (// @vitest-environment nuxt):nuxt/dist/diagnostics/core.jsis missing from the installednuxtpackage, andvirtual:intlify-i18n-0cannot be resolved. None of them touches the sitemap code, and the lockfile is unchanged. I could not get them running in this environment.pnpm quality: ESLint errors 186 (baseline 186), warnings 17, TS errors 3. No regression, baseline unchanged.pnpm build: passes.https://claude.ai/code/session_01A9Zgvt4WR2zDBkAHaK1FjL