Go Back   vb.org Archive > vBulletin Modifications > vBulletin 3.8 Modifications > vBulletin 3.8 Template Modifications

Reply
 
Thread Tools
Get multi-lingual forums indexed in Google. Details »»
Get multi-lingual forums indexed in Google.
Version: 1.00, by Alfa1 Alfa1 is offline
Developer Last Online: Dec 2020 Show Printable Version Email this Page

Category: Board Optimization - Version: 3.8.0 Rating:
Released: 01-18-2009 Last Update: Never Installs: 14
Template Edits
Re-useable Code Code Changes Translations  
No support by the author.

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

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 01-19-2009, 08:05 PM
iogames's Avatar
iogames iogames is offline
 
Join Date: Jan 2007
Location: Las Vegas, NV.
Posts: 1,433
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It works?
Reply With Quote
  #3  
Old 01-20-2009, 06:31 PM
Alfa1's Avatar
Alfa1 Alfa1 is offline
 
Join Date: Dec 2005
Location: Netherlands
Posts: 3,537
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, it does. Do you have a question about it? if there's anything you want clarified let me know.
Reply With Quote
  #4  
Old 01-21-2009, 11:21 PM
dreads dreads is offline
 
Join Date: Feb 2007
Posts: 141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #5  
Old 01-22-2009, 11:30 AM
zooki zooki is offline
 
Join Date: May 2006
Location: uk
Posts: 111
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hey this is quite good, I have 10 different languages on my site, so I will try it out later
Reply With Quote
  #6  
Old 01-22-2009, 02:09 PM
zooki zooki is offline
 
Join Date: May 2006
Location: uk
Posts: 111
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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> 
Reply With Quote
  #7  
Old 01-22-2009, 09:41 PM
Alfa1's Avatar
Alfa1 Alfa1 is offline
 
Join Date: Dec 2005
Location: Netherlands
Posts: 3,537
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by zooki View Post
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 View Post
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> 
Reply With Quote
  #8  
Old 02-01-2009, 02:15 AM
Alfa1's Avatar
Alfa1 Alfa1 is offline
 
Join Date: Dec 2005
Location: Netherlands
Posts: 3,537
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #9  
Old 02-02-2009, 01:10 AM
tefon tefon is offline
 
Join Date: Aug 2008
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

what's demo adress?
Reply With Quote
  #10  
Old 02-02-2009, 09:54 PM
Alfa1's Avatar
Alfa1 Alfa1 is offline
 
Join Date: Dec 2005
Location: Netherlands
Posts: 3,537
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:39 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05656 seconds
  • Memory Usage 2,334KB
  • Queries Executed 24 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete