Open pago93 opened 6 months ago
The default behavior is that the default language is created without a prefix. This is so that accessing /
on prerendered pages still returns something.
However, I understand that you would probably want there to still be something on /[defaultLanguage]
. What behavior would you expect:
/[defaultLanguage]
and redirect to it from /
/[defaultLanguage]
as /
/[defaultLanguage]
and leave /
empty (no redirect)I'm quite partial to the first option, as that would open the door for other kinds of language-detection
For adapter static I would have expected the second option (prerendering both). It does come at a cost of duplicated files on the server, but I would expect it to be the best option performance wise.
I am fine with option one too. There may be some break-even point between an additional roundtrip to the server to get the prerendered page vs just serving the fallback page at this point. I am no SEO Expert but there might be considerations regardings this too. Ideally if there could be a switch between both ways in some kind of options, everyone can optimize for their own scenario.
Option 3 seems to only shift the problem in another way. So I don't see any benefits from it.
My concern with option 2 is that it's difficult to tell search-engines about alternate versions of the page, since the page now exists in two places.
Option 1 seems like a more reasonable default.
Seems like option 2 is what other people expect as well. I'll see how I can handle this. https://twitter.com/loris_sigrist/status/1777635207304069196
Perhaps we can tell search engines that /
has the language x-default
, which is the canonical way of saying it's the default language. Perhaps a canonical
tag is necessary as well
When setting
export const prerender = true;
in+layout.ts
no files for the optional default languages get created with@sveltejs/adapter-static
.I've got these default settings for inlang:
I would have expected to see these folders after build:
But the there isn't even a
en
folder created. Therefore prerendering for the default language only works if accessinghttps:\\my-site\
and not viahttps:\\my-site\en
.