XOOPS

SEO of XOOPS, Theme & Core

wishcraft  07-Apr-2012 18:29 761 Reads   No comments 
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 <meta name="description" content="<{$xoops_meta_description}>" /> 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 <title></title> tag
  • Keywords in the URL
  • Keywords in the <h1></h1> to <h5></h5> tags
  • Keywords in the <p></p> 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.
<?php

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

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.

Comments:https://xoops.org/modules/newbb/viewtopic.php?topic_id=75003&forum=73&post_id=345553#forumpost345553

Rating 0/5
Rating: 0/5 (0 votes)
Voting is disabled!


Login

Who's Online

216 user(s) are online (10 user(s) are browsing Publisher)


Members: 0


Guests: 216


more...

Donat-O-Meter

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

Latest GitHub Commits

Categories