Just doing my daily reading, posting and forums here. It’s a never ending learning experience in this business (that’s one of the things I love about it so much).
Anyway.. I was looking at a post at WebProWorld where the poster was asking about how best to set up the linking on their multi-lingual website for the search engines and I was blown away by a little snippet of code which another one of the posters brought to the table.
The code is using the <link> tag. Simple tag which I use on all sites for linking my CSS style sheets and other items (favicon etc.).
Here’s the tag Webnauts provided: <link rel="alternate" hreflang="fr" href="french.html" />.
That is just unflippinbelievable! … ok sorry about that … lets break it down technically a bit then I’ll splain it in layman’s terms.
- rel is relationship = alternate (meaning an alternative to the page you’re on)
- hreflang means the hypertext reference language in other words the alternate language of the target page = fr (french in this case)
- href the hypertext reference or target page (link) = french.html the same page in french
So what happens…
the site visitor comes to your site http://www.mysite.com/index.shtml (lets say the english page). The the request for the page is sent to the server, the information regarding the visitors’ default language (that they’ve set on their computer (also known as client)) is sent with that request. The server will send them back (not the page requested) but the alternate page depending on their default language.
And all this time I’ve been using javaScript to read the language then forward the visitor! DOH!
Best thing.. the search engines actually follow the <link> tag and will index each of the alternative languages!
Totally wicked!
For a bit more info.. here’s the link that Webnauts provided in his post: http://www.richinstyle.com/guides/essential24.html and here’s some of the tech specs from W3Schools.
