vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=236)
-   -   Board Optimization - Get multi-lingual forums indexed in Google. (https://vborg.vbsupport.ru/showthread.php?t=202296)

Alfa1 01-18-2009 10:00 PM

Get multi-lingual forums indexed in Google.
 
1 Attachment(s)
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:
PHP Code:

<html xmlns="http://www.w3.org/1999/xhtml" dir="$stylevar[textdirection]lang="$stylevar[languagecode]"

Replace with:
PHP Code:

<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 01-19-2009 08:05 PM

It works? :(

Alfa1 01-20-2009 06:31 PM

Yes, it does. Do you have a question about it? if there's anything you want clarified let me know.

dreads 01-21-2009 11:21 PM

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 01-22-2009 11:30 AM

hey this is quite good, I have 10 different languages on my site, so I will try it out later :)

zooki 01-22-2009 02:09 PM

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>
PHP Code:

<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?

PHP Code:

<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 01-22-2009 09:41 PM

Quote:

Originally Posted by zooki (Post 1721211)
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.

Quote:

Originally Posted by zooki (Post 1721211)
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:
PHP Code:

<if condition="$foruminfo['forumid']=41">lang="FR"</if> 


Alfa1 02-01-2009 02:15 AM

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-02-2009 01:10 AM

what's demo adress?

Alfa1 02-02-2009 09:54 PM

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.


All times are GMT. The time now is 01:52 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01056 seconds
  • Memory Usage 1,764KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete