I have a multilingual website. How do I add parameters or a URL without too much work?

安稳与你 提交于 2019-12-24 10:15:59

问题


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!


回答1:


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.

<a href="about.aspx?lang=el">ellinika</a>

Now, on your PageLoad you check to see if you find this parameter lang=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



来源:https://stackoverflow.com/questions/9050272/i-have-a-multilingual-website-how-do-i-add-parameters-or-a-url-without-too-much

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!