SEO and multilingual pages

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 лет назад
U think that also, but from which class??
13 лет назад
Interesting..I guess using ../store/?language=en   or   ../store/?language=nl in the url doesn't work?

../store/en or ..store/nl could be used too and then via een session var you set the correct language once
13 лет назад
@ajhvdb We try to make url link in address bar to be more user friendly in most of the cases.

@Nicolas One more question.

How did you create code for default pages and get result for every language because it is not written anywhere in UrlRewriting.config?

I mean http://www.superior-extensions.com/ for english and http://www.superior-extensions.com/fr/ for france
13 лет назад
@antegtvn : My solution places the default language of your site at the root. So http://www.superior-extensions.com/ gives you the home page for default languege, http://www.superior-extensions.com/fr/ is the home page for french.

To do that, in SEOHelper, I updated this function :

        public static string GetHomeUrl()
        {
            return CommonHelper.GetStoreLocation() + /* update here */ GetLocaleSubFolder();
        }



I call it each time I need a link to the homepage.

As I said in previous post, on thing is missing : I am not actually able to change dynamicly the language using locale subfolder. Example : if you choose english, then you add /fr/ in the url, you still are in english...

The solution could be in url rewriting process. We can change regex in urlrewriting.config to transform /fr/ in a parameter like lang=fr like this :
   <add name="LocProductDetailsRewrite" virtualUrl="^~/([\w-]*)/products/([0-9]*)-([\w-]*)\.aspx(?:\?(.*))?"
         rewriteUrlParameter="ExcludeFromClientQueryString"
         destinationUrl="~/product.aspx?lang=$1&amp;productid=$2&amp;$4"
         ignoreCase="true" />


Then need to find the best place in code to analyse this parameter and change the NopContext.Current.WorkingLanguage. Perhaps this place is WorkingLanguage (get) property itself.
13 лет назад
I agree with you Nicholas.

I was thinking about to maybe to do the same thing but with languageId. You solution is even better.

This is one of the reason why the nopcommerce have problem with search engins and reading other languages.

It will be good if nopCommerce team works on this solution also. As I say earlier the flags or even the dropdownbox does not have need funcionality for Seo in other languages, because they are usually links as they shold be.
13 лет назад
I' m almost have than everything as I want, but now I have the problem.

For flags that are used to change the language NopCommerce use ImageButton which among its features is that if the flag is selected (clicked):

protected void BtnSelectLanguage_OnCommand (object sender, CommandEventArgs e)
        {
            if (e.CommandName.Equals (SelectLanguage "))
            {
                int languageId = Int32.Parse (e.CommandArgument.ToString ());
                var language = LanguageManager.GetLanguageById (languageId);
                if (language! = null & & language.Published)
                {
                    NopContext.Current.WorkingLanguage = language;
                    CommonHelper.ReloadCurrentPage ();
                }
            }
        }

This call is used to change the language, that is more accurate with:
NopContext.Current.WorkingLanguage = language;

NopContext.Current.WorkingLanguage in itself creates Coockie in accordance with the selected language:
CommonHelper.SetCookie (Nop.CustomerLanguage "value.LanguageId.ToString (), new timespan (365, 0, 0, 0, 0));


After a mighty torment I managed to create a Hyperlink control to change the language with the flags, etc. I have a couple of final issues, but one of the greatest to me is how to create cookie for language is selected (flag clicked), because as you know asp:Hyperlink does not contain OnClick or OnClientClick method in itself.

If anyone has an idea how to solve this problem?
13 лет назад
Did you try asp:LinkButton?
13 лет назад
I know it can be asp:LinkButton, but I I do not want that. I can leave than as it is as ImageButton.

I wan to be a hyperlink, because, that is what search engins recognize with no problem.
13 лет назад
antegtvn wrote:
I know it can be asp:LinkButton, but I I do not want that. I can leave than as it is as ImageButton.

I wan to be a hyperlink, because, that is what search engins recognize with no problem.


Ok, but  when asp renders you asp:LinkButton it became a simple hyperlink, with some script to post you action. But it's perfectly recognised by search engines! And it's the same thing for imageButton!
13 лет назад
I simply use Attribute.Add

string coockie = String.Format("javascript:setCookie('{0}','{1}','{2}')", "Nop.CustomerLanguage", language.LanguageId.ToString(), new TimeSpan(365, 0, 0, 0, 0));
                            hpLanguage.Attributes.Add("onclick", coockie);

Now the second thing that I need to do is to show all result by selected language.

Now every time I try to click something on other language, like category, it redirect me to the home page.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.