使用 Cookies 搜索引擎的本地化是否兼容?
我正在本地化一个网站。我打算将 cookie 设置为首选语言,然后显示相应的语言。而且,如果未设置 cookie,它将使用用户浏览器设置的首选语言标头 - 如果未设置标头,则它将默认为英语。
那么 - 谷歌的机器人是如何工作的?它是否会在标题中设置不同的语言,对所有网站进行一次抓取,以便获取网站的每个版本,或者甚至设置标题?如果没有,那么我是否必须重新构建所有这些,以便使用基于 URL 的语言选择器(www.domain.com/en/page.html www.domain.com/fr/page.html)。
I'm in the process of localizing a website. I was going to go the way of setting a cookie to the preferred language, and then display the respective language. And, if no cookie was set it would use the preferred language header, as set by the user's browser - and if the header was not set then it would default to English.
So - how does Google's bot work? Will it crawl all websites once each with a different language set in the headers so that it can get each version of the website, or does it even set headers? If not, then do I have to restructure all this so as to use a URL based language selector (www.domain.com/en/page.html www.domain.com/fr/page.html).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,Google 不使用 cookie。直到最近它还没有消耗 javascript,但他们现在已经开始这样做了,尽管我不能说它的工作效果如何(可能不太好)。除了 Flash(它也只能从中获取文本和链接)之外,它唯一消耗的就是文本和超链接。
我的感觉是使用以下内容:
1)TLD /子域(用于确定子域语言的正则表达式)
2)“内容语言”的HTTP标头
3)语言检查(他们确实有翻译器,所以必须能够做到这一点)
4) 来自其他 TLD 的入站链接
5) 网站管理员工具 - 可以在其中设置位置
可能最好的方法是使用所有这些东西的合并并使用某种评分系统来确定哪些文档(页面/域)是基于语言,但直到谷歌让人们使用网站管理员工具之前,它并没有真正发挥作用。
需要记住的一件事是,网络上的大部分流量都会流向少数网站,因此如果您可以手动覆盖这些网站,也许会让生活变得更轻松。
干杯柯
As far as i know Google does not consume cookies. Up until recently it also didnt consume javascripts, but theyve started to do that now, although I cannot say how well it works (probably not well). About the only thing the do consume is text and hyperlinks, apart from flash (which it only gets text and links from too).
My feeling is that the following are used:
1) TLD/Subdomain (regex to determine language from subdomain)
2) HTTP Header for "Content-Language"
3) Language checking (they do have a translator, so must be able to do this)
4) Inbound links from other TLDs
5) Webmaster tools - its possible to set location in there
Probably the best way is to use an amalgamation of all these things and use some kind of scoring system to determine which documents (pages/domains) are language based, but it didnt really work great until Google got people using webmastertools.
One thing to bare in mind is that most of the traffic on the net goes to a handful of websites, so if you can cover these off manually maybe it might make life easier.
Cheers Ke
简短回答:否。引擎不喜欢cookie。使用 HTML 提供它们(并确保所有语言都通过 HTML 获得超链接)
Short answer: No. Engines do not like cookies. Feed them with HTML (and be sure all your languages are getting hyperlinked by the HTML)