Craft CMS 4多语言最佳实践

huangapple go评论68阅读模式
英文:

Craft CMS 4 multi language best practices

问题

大多数多语言网站在URL中显示区域设置。例如:https://www.stackoverflow.com/en。
但在Craft中,似乎存在一个问题,即默认语言似乎也可以在URL中不带有区域设置的情况下工作。这也导致了Google的索引问题。
我目前已经设置了两种语言,它们都有自己的基本URL,由相同的主机名组成,但以不同的区域设置结尾。

但是,Craft不会自动将用户从https://www.stackoverflow.com重定向到https://www.stackoverflow.com/en。尽管这是默认设置。
而且,https://www.stackoverflow.com/en/about 和 https://www.stackoverflow.com/about 似乎都是有效的URL。

如果我从默认语言的URL中删除区域设置,是否会更好?
这种设置方式有点奇怪,因为它将不会为所有语言提供一致的URL结构,但这可能会解决我的索引问题。

英文:

Most multi language sites show the locale in the URL. For example: https://www.stackoverflow.com/en.
With Craft the issue seems to be that the default language seems to also work without the locale in the URL. This is also causing indexing issues with Google.
I currently have languages setup and both have their own base URL which consists out of the same hostname but end with a different locale.

But Craft does not automatically redirect users from https://www.stackoverflow.com to https://www.stackoverflow.com/en. Even though this is the default.
And both https://www.stackoverflow.com/en/about and https://www.stackoverflow.com/about seem to be valid URL's.

Would it be better if I would remove the locale in the URL from the default language?
It's a little bit weird to have it setup this way since it will not have a consistent URL structure for all languages but it might fix my indexing issues.

答案1

得分: 1

我猜这很大程度上取决于用例。我对多语言网站的默认方法之一是以下之一:

我更喜欢第一种方法,因为我认为不涉及重定向会更简单。复杂的解决方案往往容易出现故障,并以奇怪的方式引发问题。当我在旅行时浏览网页时,有时因为故障的重定向而无法访问某些内容。

我更喜欢一个明显的语言切换或通知,类似于苹果网站上显示的那种。

英文:

I guess it very much depends on the use case. My default approach to Multi-Language sites is one of the following:

I prefer the first approach, as I assume it is just less complex to not have a redirect involved. Complex solutions tend to break and cause problems in weird ways. When I browse the web while travelling I sometimes cannot even access some content because of malfunctioning redirects.

I rather prefer a prominent language switch or notice, analog the one shown on the Apple website.

huangapple
  • 本文由 发表于 2023年6月19日 16:42:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/76504998.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定