1
wishcraft
SEO of a XOOPS Theme & Core

I have written this article a number of times on this forum, I think the last was in 2007 so I will write it again to update with preloads and other systems which are now congruent in XOOPS.

SEO of XOOPS is important, a lot of the theme will give you a less than desirable outlook in search engines as well as rank you down cause of keyword stuff or the use of Keyphrases as keywords.

Most SEO companies you speak to will not tell you this and I will say as one of the invested interests in HTML vs GOPHER where my additions like META Tags was inclusive in the HTML Document standard which vested for me beat gopher as a document standard for the world wide web back in the days before TCP/IP or even PPP where you had to log into local BBS Systems to communicate on Usenet where everything we do on the web these days was done.

Step 1 - The Theme:

Most themes will be inclusive of the META DESCRIPTION on all pages, this means absolutely NONE of your content will be searchable when this tag is present, you can either completely drop it or better still only use the tag when system is present in the main module running. This will mean you have to edit your theme and change the line which instanciates the themes meta description which will look like with the following code:

<{if $xoops_dirname eq 'system'}>
<
meta name="description" content="<{$xoops_meta_description}>" />
<{if}>


This will mean every page except for system ones will be index as there entirity and the content on those pages are searchable by search engines, if you leave the meta description there the only content which will be searchable on the page is the meta description itself, meaning there is little or no point having a forum or any other content in search engines, better still they may not even be indexed cause of them all being the same.

Step 2 - Keywords:

XOOPS functionally as itself does not do very good with keywords, there is something that is policed heavily by things like Bing less so by google called Keyword Stuffing - which is the use of the same keywords on every page. To solve this orginally in my posts i would do a hack to the theme, but this can now be done with a preloader. Remember the field is Keywords not Keyphrases which is a BIG MISTAKE. If you put keyphrases in here not only will your score be lower, it will not index. Traditionally keywords comprise of the main words in the following parts in your site:

  • Keywords in the tag
  • Keywords in the URL
  • Keywords in the

    to
    tags
  • Keywords in the

    tag

This rates in highest to lowest score in this list. To isolate the keywords and prevent any keyphrases from being entered which is completely wrong and a major mistake by even the most Expensive SEO companies that are just informed wrong or really can't read or understand what the word keywords means which is 1 word seperated by a comma, you can run the following preloader in the system area.

Place this code in a file called antistuffing.php in /htdocs/modules/system/preloads/ and it will fix any keyword issues you are having as well as stop the XOOPS platform from stuffing you into a nightmare.

defined
('XOOPS_ROOT_PATH') or die('Restricted access');

class 
SystemAntistuffingPreload extends XoopsPreloadItem
{
    function 
eventCoreHeaderCheckcache($args)
    {
        global 
$xoopsTpl$xoTheme;
        
        
$search = array(' and '' the '' there '' their '' they're ', ' are ', ' to ', ' when ', ' on ', ' by ', ' you ',' ','.','<','>','"',';',':','}','{','[',']','|','\','/','=','+','-','_',')','(','*','&','^','%','$','#','@','!','~','`');
        
$minimumwordlen = 4;

        // Gets Meta Data
        
$path = str_replace($search, ',', str_replace(basename($_SERVER['REQUEST_URI']), '', $_SERVER['REQUEST_URI']));
        
$sitename = $xoTheme->template->_tpl_vars['xoops_sitename'];
        
$slogon = $xoTheme->template->_tpl_vars['xoops_slogan'];
        
$pagetitle = $xoTheme->template->_tpl_vars['xoops_pagetitle'];
        
$keywords = $xoTheme->metas['meta']['keywords'];
        //
$description = $xoTheme->metas['meta']['description'];
        
$sitename .= ','.$xoopsTpl->currentTheme->template->_tpl_vars['xoops_sitename'];
        
$slogon .= ','.$xoopsTpl->currentTheme->template->_tpl_vars['xoops_slogan'];
        
$pagetitle .= ','.$xoopsTpl->currentTheme->template->_tpl_vars['xoops_pagetitle'];
        
$keywords .= ','.$xoopsTpl->currentTheme->metas['meta']['keywords'];
        //
$description .= ','.$xoopsTpl->currentTheme->metas['meta']['description'];

        // Makes Unique Keyword Sentence with NO KEYPHRASES - A KEY PHRASE IS AN INCORRECT USE OF THE META TAG 'KEYWORDS'
        
$nophrase = str_replace($search, ',', $path.str_replace($search, ',', $sitename).','.str_replace($search, ',', $slogon).','.str_replace($search, ',', $pagetitle).','.str_replace($search, ',', $keywords)/*.','.str_replace($search, ',', $description)*/);
        
$keywords = array_unique(explode(',', $nophrase));
        foreach(
$keywords as $id => $word) {
            if (strlen(
$word)<$minimumwordlen) {
                unset(
$keywords[$id]);
            }
        }        
        
$xoopsTpl->currentTheme->metas['meta']['keywords'] = implode(',', $keywords);
        
$xoTheme->metas['meta']['keywords'] = implode(',', $keywords);
    }
    
    function eventCoreFooterStart(
$args)
    {
        global 
$xoopsTpl$xoTheme;
        
        
$search = array(' and ', ' the ', ' there ', ' their ', ' they're ', ' are ', ' to ', ' when ', ' on ', ' by ', ' you ',' ','.','<','>','"',';',':','}','{','[',']','|','\','/','=','+','-','_',')','(','*','&','^','%','$','#','@','!','~','`');
        
$minimumwordlen 4;

        
// Gets Meta Data
        
$path str_replace($search','str_replace(basename($_SERVER['REQUEST_URI']), ''$_SERVER['REQUEST_URI']));
        
$sitename $xoTheme->template->_tpl_vars['xoops_sitename'];
        
$slogon $xoTheme->template->_tpl_vars['xoops_slogan'];
        
$pagetitle $xoTheme->template->_tpl_vars['xoops_pagetitle'];
        
$keywords $xoTheme->metas['meta']['keywords'];
        
//$description = $xoTheme->metas['meta']['description'];
        
$sitename .= ','.$xoopsTpl->currentTheme->template->_tpl_vars['xoops_sitename'];
        
$slogon .= ','.$xoopsTpl->currentTheme->template->_tpl_vars['xoops_slogan'];
        
$pagetitle .= ','.$xoopsTpl->currentTheme->template->_tpl_vars['xoops_pagetitle'];
        
$keywords .= ','.$xoopsTpl->currentTheme->metas['meta']['keywords'];
        
//$description .= ','.$xoopsTpl->currentTheme->metas['meta']['description'];

        // Makes Unique Keyword Sentence with NO KEYPHRASES - A KEY PHRASE IS AN INCORRECT USE OF THE META TAG 'KEYWORDS'
        
$nophrase str_replace($search','$path.str_replace($search','$sitename).','.str_replace($search','$slogon).','.str_replace($search','$pagetitle).','.str_replace($search','$keywords)/*.','.str_replace($search, ',', $description)*/);
        
$keywords array_unique(explode(','$nophrase));
        foreach(
$keywords as $id => $word) {
            if (
strlen($word)<$minimumwordlen) {
                unset(
$keywords[$id]);
            }
        }        
        
$xoopsTpl->currentTheme->metas['meta']['keywords'] = implode(','$keywords);
        
$xoTheme->metas['meta']['keywords'] = implode(','$keywords);
    }
}

?>


Step 3 - Traffic Tracking:
It is important to track your traffic with something like Google Analytics once you have signed up and been given your UA number you will have to edit the part of this code which is UA-XXXXXX-X to your UA Number.

Place this code in a file called analytics.php in /htdocs/modules/system/preloads/ and it will include Google Analytics into every page on your site.

defined
('XOOPS_ROOT_PATH') or die('Restricted access');

class 
SystemAnalyticsPreload extends XoopsPreloadItem
{
      function 
eventCoreHeaderAddmeta($args)
    {
        if (
is_object($GLOBALS['xoTheme'])&&!isset($GLOBALS['analytics'])) {
            
$GLOBALS['analytics'] = true;
            
$GLOBALS['xoTheme']->addScript('', array('type' => 'text/javascript'), "  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXXX-X']);
  _gaq.push(['_setDomainName', '." 
basename($_SERVER['HTTP_HOST']) . "']);
  _gaq.push(['_setAllowLinker', true]);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();"
);
        }
    }
}

?>


Step 4 - Page Titles
You may have to edit the modules you have to make sure the page title is as unique as possible in the module, not all modules have good page titles, I know when I edited the modules on xoops.org for page titles a lot had to be made unique. This means you will have to find in the code the part that sets or by setting it your the $GLOBALS['xoopsTpl']->assign('xoops_pagetitle', '....');.

This may take some programming skills to find things like category name the module name and other details you want in the page title, remember this will reflect in your keywords as well with the Anti Stuffing preloaded making your keywords completely unique for a individual page on an item, which is what will reflect in your over all score.

Written By: Simon a. Roberts (wishcraft)
One of the founders of the internet & web
ps. Contact me if you need help my details are on my User Profile, Skype or MSN are the best.
Resized Image
http://www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/RegaltyFamily
github.com/Chronolabs-Cooperative
facebook.com/DrAntonyRoberts

2
bjuti
Re: SEO of a XOOPS Theme & Core
  • 2012/4/8 8:18

  • bjuti

  • Just can't stay away

  • Posts: 871

  • Since: 2009/1/7 2


Great, and well known for me :) I didn't used preloads ever, so I tried. The first one have syntax error on line 11 (expecting ')' ) :)

Is it possible to make xoops preload for Facebook api?

3
radwan
Re: SEO of a XOOPS Theme & Core
  • 2012/4/8 14:45

  • radwan

  • Just popping in

  • Posts: 32

  • Since: 2012/2/10


Great , Thank you wishcraft

4
wishcraft
Re: SEO of a XOOPS Theme & Core

Actually there is no error with that line 11, it is edited in by gsehi, the XOOPS code displaying library it should read a \\ where the single \ is, there should also be \ where ' appear in they\'re, just more of those core bugs that never seem to get fixed or introduced.

$search = array(' and ', ' the ', ' there ', ' their ', ' they\'re ', ' are ', ' to ', ' when ', ' on ', ' by ', ' you ',' ','.','<','>','"',';',':','}','{','[',']','|','\\','/','=','+','-','_',')','(','*','&','^','%','$','#','@','!','~','`');
Resized Image
http://www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/RegaltyFamily
github.com/Chronolabs-Cooperative
facebook.com/DrAntonyRoberts

5
Mamba
Re: SEO of a XOOPS Theme & Core
  • 2012/4/9 9:37

  • Mamba

  • Moderator

  • Posts: 11394

  • Since: 2004/4/23


Simon, can you help with fixing it, so we could include it in XOOPS 2.5.5 Final?
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

6
bjuti
Re: SEO of a XOOPS Theme & Core
  • 2012/4/24 12:41

  • bjuti

  • Just can't stay away

  • Posts: 871

  • Since: 2009/1/7 2


I've added it in Car owners manuals and I'll see is there any positive search engine result. :)

Is it possible something similar to be done with smarty plugin?

7
timgno
Re: SEO of a XOOPS Theme & Core
  • 2012/4/24 17:00

  • timgno

  • Module Developer

  • Posts: 1504

  • Since: 2007/6/21


You can also edit the file system/preloads/core.php removing lines of code pointing to the file jquery.js

$GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/jquery.js');


and place them in another specific function to monitor possible conflicts of duplicates of the same jquery.

Just create this function:

function eventCoreHeaderAddJQuery($args

    
$GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/jquery.js');
    
$GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js');
}


and delete the same lines from other functions above core.php file.

Of course if you have rows of type code:

<script type="text/javascript" src="http://localhost/xoops-2.5.4/htdocs/browse.php?Frameworks/jquery/jquery.js">script>
<
script type="text/javascript" src="http://localhost/xoops-2.5.4/htdocs/browse.php?Frameworks/jquery/plugins/jquery.ui.js">script>


now we need to remove this line otherwise in theme.html there is duplicate.

8
timgno
Re: SEO of a XOOPS Theme & Core
  • 2012/4/24 17:28

  • timgno

  • Module Developer

  • Posts: 1504

  • Since: 2007/6/21


See this tutorial for more details

9
wishcraft
Re: SEO of a XOOPS Theme & Core

Quote:
by Mamba on 2012/4/9 20:37:54

Simon, can you help with fixing it, so we could include it in XOOPS 2.5.5 Final?


All you have to do is include the preloader and adjust the theme on xoops.org, i sent you the files, perhaps it would also be good having a config entry for your google analytics code for the preloader, if there is going to be a 2.5.6 we will do it in this version, otherwise it will be included in 2.6.0 i will add it to my branch.

I think there should be a 2.5.6 anyway to finalise on it - plus for all those 256K eproms out there how could you refuse.
Resized Image
http://www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/RegaltyFamily
github.com/Chronolabs-Cooperative
facebook.com/DrAntonyRoberts

10
wishcraft
Re: SEO of a XOOPS Theme & Core

When i did this SEO on XOOPS.org in 2008, the direct access was around 24%, referee was around 60% and search engine access was around 20%. After a month Search engine access had gone to 45% and referee was dropped to around 30% and he hit rates increased by over 400% of people access the forum for help and tutoring cause they could find relevant content.

The other thing I am going to introduce into 2.6.0 is a system similar to the search function for /sitemap.php the XML file required by search engines for indexing, modules will have to provide their relevant URL link list via a system like the search function to sitemap.php within quote and limit, remember sitemap.php is at a maximum allowed to put out 10Mbs of data.

This is another serious absent part XOOPS has required for sometime. And VERY important to SEO.
Resized Image
http://www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/RegaltyFamily
github.com/Chronolabs-Cooperative
facebook.com/DrAntonyRoberts

Login

Who's Online

289 user(s) are online (105 user(s) are browsing Support Forums)


Members: 0


Guests: 289


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits