1
votes

I'm setting up a multi-language page and I want to use the new TYPO3 v9 on-board sitemap generation feature. I read the TYPO3 docs and set up a sitemap generation config for pages.

Now I can request https://example.com/sitemap.xml - this gives me a sitemap-index file with one entry that is pointing to a valid sitemap.xml file, but I cannot see any of the other languages.

It is possible to request https://example.com/EN/sitemap.xml also and I could add more Sitemap: directives to robots.txt, but is that correct?

Can somebody give me a hint how to configure TYPO3 sitemap feature for multiple languages within my typoscript setup?

Best regards, Lex

BTW: I'm using <link rel="alternate" hreflang="en" href="https://example.com/en/"> in HTML head area, also.

1

1 Answers

4
votes

If your language setup is correct, the sitemap will be generated for each language automatically.

In your site config (yaml) --> config/sites/your_site/config.yaml

Language configuration (example)

languages:
-
  title: English
  enabled: true
  languageId: '0'
  base: /
  typo3Language: en
  locale: en
  ....
-
  title: 
  enabled: true
  languageId: '1'
  base: /sv/
  typo3Language: sv
  locale: sv_SE
  ....

Would result in two languages on the same domain, with a path per language

  • your-domain.xy/ = English
  • your-domain.xy/sv/ = Swedish

If you want to use domains instead of a path (e.g. domain-1.xy for language 1 and domain-2.xy for language 2), you have to set the base url in your yaml config for each language.

For rewriting the sitemap:

routeEnhancers:
  PageTypeSuffix:
    type: PageType
    limitToPages:
      - 1
    map:
      sitemap.xml: 1533906435

This would result that the sitemap(s) are accessible with a rewritten url, limited to page with ID 1.

  • your-domain.xy/sitemap.xml --> English sitemap, listing english pages
  • your-domain.xy/sv/sitemap.xml --> Swedish sitemap, listing swedish pages

So to generate a sitemap per language, you need to:

  • Setup your languages correctly (prefer the new yaml configuration instead of TypoScript)
  • Activate the new TYPO3 SEO sysext
  • Optional: rewrite type=1533906435 to sitemap.xml (or another name)