#In SSR, should I use slug or cookie is sufficient for multilanguage speaking of SEO?

4 messages · Page 1 of 1 (latest)

quartz ravine
#

I'm learning Astro and trying out concepts

While using SSR (site is fully SSR), I can use cookies and via cookie, I can fetch collection

In that case, I want to handle multilanguage by using collections since I don't fancy creating copies of one page for indefinite amount of languages when necessary

Is it good practice to not have current language in slug?
I'm thinking of SEO mostly

steel windBOT
#

Hi @quartz ravine. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Astro doesn't have built-in internationalization (i18n) support, but you can build your own i18n solution using content collections and dynamic routing to serve content for different languages. This approach can be beneficial for SEO as it allows each language to have its own unique URL, which can be indexed separately by search engines.

However, if you prefer the default language to not be visible in the URL unlike other languages, there are instructions to hide the default language in the URL. This can be achieved by setting up src/pages/index.astro to redirect to your default language using a meta refresh (https://en.wikipedia.org/wiki/Meta_refresh) or Astro.redirect if you are using an SSR adapter[^1^].

In terms of using cookies, there was an issue reported on Astro's GitHub where cookies were not working as expected[^5^]. However, this issue might have been resolved in the newer versions of Astro. It's recommended to check the latest updates or issues related to cookies in Astro's GitHub repository.

In terms of SEO, it's generally recommended to include the language in the URL for multilingual websites. This makes it clear to search engines and users what language the page is in. However, this is not a strict rule and depending on your specific use case and requirements, you might decide to implement it differently.

Remember, the key to good SEO is clear, well-structured, and meaningful URLs among other factors. Whether or not you include the language in the URL, it's important that your content is easily accessible and understandable to both users and search engines.