我有一个多语言网站。如何添加参数或 URL,而不需要太多工作?
我有一个公司网站(Visual Studio / VB / ASP.NET 4.0)。我将我的网站本地化为 10 种不同的语言和文化。
问题:虽然 @Stefan 指出 Google 不会因为重复内容而惩罚我,但我的所有网址都是相同的。例如,英语的 about.aspx 仍然是法语的 about.aspx —— 它只是从“fr”资源文件而不是“en”资源文件调用页面并相应地显示它。 因此,尽管页面上的语言发生了变化,但 URL 永远不会改变。
@Aristos 建议我向我的网站添加参数或URL,我并不反对。这将使客户了解他们正在访问网站的法语部分或瑞典语部分,也许 Googlebots、Yahoobots 会更喜欢这一点。事实上,我想我真的很喜欢这个建议。
我认为@Aristos 当他说“添加参数”时建议我在 URL 末尾添加 about.aspx?lang=FR 或其他内容。我当前的链接如下所示:
<asp:LinkButton ID="LinkButton7" runat="server"
CommandArgument="nl" OnClick="RequestLanguageChange_Click" class="flagbutton">
<asp:Image ID="Image1" runat="server" ImageUrl="~/images/flagnl.png" tooltip="Bekijk deze website in het Nederlands" title="Bekijk deze website in het Nederlands"/>
<img class="map" src="images/flaghovernl.png" alt=""/>
</asp:LinkButton>
但是如何添加参数?这会是一个复杂的过程吗?我的所有资源文件都在 app_globalresources 中。我正在寻找最简单、对 SEO 最友好的解决方案。任何这方面的指导将不胜感激!
I have a company website (Visual Studio / VB / ASP.NET 4.0). I localized my website in 10 different languages and cultures.
The Problem: Although @Stefan noted that Google will not punish me for duplicate content, all of my URLs are the same. For instance, about.aspx in English is still about.aspx in French -- it just calls the page from the "fr" resource file instead of the "en" resource file and displays it accordingly. So the URL never changes, although the language on the page changes.
@Aristos suggested I add a parameter or a URL to my website, which I'm not opposed to. This will allow clients to understand they're in the French portion or the Swedish portion of the website, and perhaps Googlebots, Yahoobots, will like this more. Actually, I think I REALLY like this suggestion.
I think what @Aristos was suggesting when he says "add a parameter" was that I would have about.aspx?lang=FR or something at the end of the URL. My current links look like this:
<asp:LinkButton ID="LinkButton7" runat="server"
CommandArgument="nl" OnClick="RequestLanguageChange_Click" class="flagbutton">
<asp:Image ID="Image1" runat="server" ImageUrl="~/images/flagnl.png" tooltip="Bekijk deze website in het Nederlands" title="Bekijk deze website in het Nederlands"/>
<img class="map" src="images/flaghovernl.png" alt=""/>
</asp:LinkButton>
But how do I add a parameter? Will it be a complex process? All of my resource files are in app_globalresources. I'm looking for the simplest solution that will be the most SEO friendly. Any guidance in this regard would be sincerely appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
现在让我们看看你的新问题。我在这里看到的也是一个不好的搜索引擎优化,而不是更改语言的最佳实践方法。
原因是您使用回发来更改语言。索引器永远不会在页面上进行回发,很少运行 javascript - LinkButton 是一个调用回发的 javascript。最好仅在插入数据或执行操作时使用回发,并且您不关心搜索引擎是否发现或跟踪回发后的内容。
实际上必须做的是创建一个简单的链接来更改语言而不是回发。
现在,在您的
PageLoad
上检查是否找到此参数lang=el
,如果找到,则显示此语言资源,如果没有,则显示默认资源。您还可以稍后进行网址重写并将
about.aspx?lang=el
转换为/el/about.aspx
Now let see your new question. What I see here is also a non good SEO and NOT best practice way to change language.
And the reason is that you use post back to change the language. And indexers never make post back on pages, rare run javascript - and the LinkButton is a javascript that call a post back. It good to use post back only when you insert data, or made an action, and you do not care if search engines found or follow whats after the post back.
What actually must do is to create a simple link that change the language and not a post back.
Now, on your
PageLoad
you check to see if you find this parameterlang=el
and if you find it you show this language resource, if not you show the default resource.You can also later make a url rewrite and convert the
about.aspx?lang=el
, to/el/about.aspx