Hi folks,
I'm relatively new to Astro but already like for its easy approaches to solve most things.
I am building a multi-language page with Astro (v5.13.5). there are "hard coded" pages (e.g. imprint.astro) and also /subpage/[...slug].astro --> everything works fine, pages are generated and have their needed content (md-files).
However, SEO entered the room. SEO wants the slugs to be translated in every language. SEO also wants the hreflang alternate links (e.g. <link rel="alternate" hreflang="de" href="https://docs.astro.build/de/guides/routing/">) for each page and of course in the sitemap, in every language. This is where things get complicated for me.
example structure:
Layout:
- ./layouts/layout.astro
Pages/Routes:
- ./pages/en/imprint.astro
- ./pages/de/impressum.astro
- ./pages/en/news/[...slug].astro
- ./pages/de/news/[...slug].astro
(two pages with translated slugs)
Content
- ./content/en/imprint.md
- ./content/de/impressum.md
- ./content/de/news/weltherrschaft-fuer-dummies.md
- ./content/en/news/world-domination-for-dummies.md
My approach so far: I added the alternate links in the content md files, in the "frontmatter" part
// impressum.md/imprint.md
alternates:
de: impressum
en: imprint
Now, the pages know its siblings in other languages. I can generate the alternate links for the head. But I don't know how to configure the sitemap plugin (<@&1055234544183287879>/sitemap v3.5.1) to also add the links. The sitemap config looks like that:
see next comment because its to long