PDA

View Full Version : Board Optimization - Get multi-lingual forums indexed in Google.


Alfa1
19 Jan 2009, 05:43
If you have a site with subforums in different languages, then you will likely have encountered a problem with getting these forums indexed in the appropiate Google index. For example, if you have English set as your board language in vbulletin options, then your German sub-forum will not do well in google.de

To solve this I have written a simple conditional, that changes the lang=X html code on a per forum basis. The example below is for two languages besides the default language. You can add more languages, by repeating the code.

In SHOWTHREAD and in FORUMDISPLAY template, find:
<html xmlns="http://www.w3.org/1999/xhtml" dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">Replace with:
<html xmlns="http://www.w3.org/1999/xhtml" dir="$stylevar[textdirection]" <if condition="in_array($foruminfo['forumid'], array(1, 2, 3, 4, 5))">lang="X"><else />

<if condition="in_array($foruminfo['forumid'], array(6, 7, 8, 9, 10))">lang="Y"><else />lang="$stylevar[languagecode]"></if> </if> Do not forget to replace the forumID numbers with your forumID numbers.
To find your forumID's go to the forums that you want search engines to perceive as a different language and note down which number comes after /forumdisplay.php?f=

Do not forget to replace X and Y with the proper language codes. Here is an overview:
http://xml.coverpages.org/iso639a.html

iogames
19 Jan 2009, 22:05
It works? :(

Alfa1
20 Jan 2009, 20:31
Yes, it does. Do you have a question about it? if there's anything you want clarified let me know.

dreads
22 Jan 2009, 01:21
if you have English set as your board language in vbulletin options, then your German sub-forum will not do well in google.de

That didnt sound right lol

zooki
22 Jan 2009, 13:30
hey this is quite good, I have 10 different languages on my site, so I will try it out later :)

zooki
22 Jan 2009, 16:09
hi First of all your code did not work properly, I am not a coder, so I changed a few things to get it to work

after each lang="X" or lang="Y" I aded ">" this will close the bracket to make the Statement appear correct. If you right click and view the source of the page in the forum, you will see.

This is the changed version>
<html xmlns="http://www.w3.org/1999/xhtml" dir="$stylevar[textdirection]" <if condition="in_array($foruminfo['forumid'], array(1, 2, 3, 4, 5))">lang="X"><else />

<if condition="in_array($foruminfo['forumid'], array(6, 7, 8, 9, 10))">lang="Y"><else />lang="$stylevar[languagecode]"></if> </if>

whats a better way to write it if I hav a lot of languages? i would then have like 10 End If statements?


<html xmlns="http://www.w3.org/1999/xhtml" dir="$stylevar[textdirection]" <if condition="in_array($foruminfo['forumid'], array(86))">lang="AR"<else />

<if condition="in_array($foruminfo['forumid'], array(89))">lang="BS"><else />
<if condition="in_array($foruminfo['forumid'], array(106, 82, 107, 108, 109, 110, 111, 112))">lang="NL"><else />
<if condition="in_array($foruminfo['forumid'], array(82, 101, 102, 103, 104))">lang="IT"><else />
<if condition="in_array($foruminfo['forumid'], array(41))">lang="FR"><else />
<if condition="in_array($foruminfo['forumid'], array(45))">lang="DE"><else />
<if condition="in_array($foruminfo['forumid'], array(85))">lang="ES"><else />
<if condition="in_array($foruminfo['forumid'], array(88))">lang="PT"><else />
<if condition="in_array($foruminfo['forumid'], array(83))">lang="RU"><else />
<if condition="in_array($foruminfo['forumid'], array(87))">lang="RO"><else />lang="$stylevar[languagecode]"></if> </if> </if> </if> </if> </if> </if> </if> </if> </if>

Alfa1
22 Jan 2009, 23:41
after each lang="X" or lang="Y" I aded ">" this will close the bracket to make the Statement appear correct.

Thanks. I missed that one. I corrected it.

whats a better way to write it if I hav a lot of languages? i would then have like 10 End If statements?
I use a good number of conditionals on my forum pages and have no problems with it. However there may be a tidier way.

For one forum, instead of an array of forums; I normally use this conditional:
<if condition="$foruminfo['forumid']=41">lang="FR"</if>

Alfa1
01 Feb 2009, 04:15
I can confirm that Google is now indexing my forums in the correct languages, as I am receiving Google alerts from google.nl and google.de
The interesting thing, is that Google sees my old topics, as new content as well, since it has never indexed it in google.de or google.de before. Only in google.com.

tefon
02 Feb 2009, 03:10
what's demo adress?

Alfa1
02 Feb 2009, 23:54
There is no demo. The only thing difference after installing this hack, is that the source of for example a German page on an English website, has a lang=de instead of a lang=en meta tag.
The proof is in the pudding in this one. Try it out for a month and see what google does.

rob01
03 Feb 2009, 00:25
do we need this if we use vbseo?

Alfa1
03 Feb 2009, 01:32
I am not sure, because I do not have vbSEO. maybe someone that has vbSEO can explain this.

luan7749
18 Feb 2009, 19:12
Not work for vietnammese lang :(

Alfa1
18 Feb 2009, 19:15
What code do you use for Vietnamese?

Fenriz
14 Oct 2009, 23:27
Is there any condition to mark forum with several languages at the same time to index it f.expl at google.no and google.com simultaneously ??

Alfa1
22 Oct 2009, 22:35
I'm not sure about that. Normally a page is only in one language. I did add comma separated variations of English to pages about a decade ago. I don't know if that would still work.