w3it.org – Internet Helper
  
www ITBlog Articles Topics Forums Main
 
    
 

Zikula SEO – the meta keywords function hacking

There is an option in Zikula administration control panel that is needed to set the mode on how to display meta keywords for dinamically created pages.

This option can be found in:  Global Settings Panels -> Owner Settings -> Dynamic meta-keywords

Scenario SEO and analysis :

By setting on Yes this option you’ll have meta keywords generated dynamically for each page and based /extracted on/from his content. More precisely, some functions are taking these words dynamically from articles, comments or from  some other contest, as text, and it will go to be outputted for the requested page.

Under a superficial SEO analysis it can be not so good thing that our site homepage, will have time by time meta tag keywords changed and different because are generated dynamically.

This can be good for all others CMS pages in our site, that maybe will not go to change so much there contents time by time because are created for a scope (an article, a singular page, a tutorial etc) and will remain untouched  except some addition of comments if there is a feature that allow this. The homepage instead, will go to change in many cases many times, because day by day his content will display in his blocks latest articles, latest forums entries etc.  Keywords dynamically generated for the  Zikula home page will go to be changed for this reason and spiders will find out any visit time, different keywords; in others words,  it depend from what your home page will go to contain: if it will go to contain static contents than the dynamic keywords generation will go to output always the same words list and it is good: the words list will go to change instead, if the page will go to contain updated news etc,  this is not good because your meta keywords list will go to be different each time.

Another SEO analysis, if you look to a dynamically generated keywords words list on Zikula, let we understand that there are many words that are not exactly words:  the function that generate the list let pass also prepositions, grammatical articles, and even single letters if there are some in contents from where keywords list is token/generated, like:  is, i, i’m.

How to change this for a better SEO your zikula pages

It is possible to apply a little patch to SEO our Zikula,  in this way:

Files to be edited: 2

themes/themeName/templates/modules/home.htm

system/Theme/plugins/function.keywords.php

If your Zikula home page contain blocks like latest news, last articles etc. than you’ll need to edit the home.htm file in this way:

Search for this line of code (near the top)

<meta name=”keywords” content=”<!–[keywords]–>” />

change the above instruction that you can find near to the top of the file in the head code declarations (in the Seabrize theme which you can find on any Zikula default download it can be found at line 7 of the home.htm)

<meta name=”keywords” content=”w3it,php,zikula,seo,hack,tutorial” />

Of course, change values for the content attribute with terms you need.

On Zikula templates we have the home.htm and the master.htm: the home is used to output the homepage for the used template, the master instead will output all others CMS’s pages. The configuration for templates on Zikula is normally more than sufficient as is, but there are many others advanced features that can be used to customize templates by adding more layout for different contents . The config folder inside the templates folder of your theme, contain the necessary to add these  layouts instructions, but it is not the only one possibility for Zikula themes (Zikula use Smarty as template engine so you can also use all Smarty features in Zikula): this is not the argument of this tutorial and for this SEO hack modification this is more than what is necessary to know and understand.

Now to avoid the problem of singles words for keywords list, it is necessary to edit the file function.keywords.php

search in the file for this code:

if (file_exists($stopword_file)) {
$stopwords = file($stopword_file);
$stopwords = array_map(’rtrim’, $stopwords);
$keywords = array_diff($keywords, $stopwords);
}

immediately after add this code:

$dk = array_keys($keywords);
foreach($dk as $d) {
$ln = strlen($keywords[$d]);
if ($ln < 3) {
unset($keywords[$d]);

this will go to eliminate all words composed by less than 3 letters. Change the value of 3 to 4 or 5 if you like to eliminate all words,  for example,  that aren’t composed of a minimum of 4 or 5 letters (i think 3 or 4 is the best choice).

This is true that there is a file that you can compile and where you can list all unwanted words one by one, but of course this way is more speedy and you can decide to cut off any insignificant word from your dynamic keyword list.

The generated keywords list is also very long in most of pages, which is also not a good SEO choice. It is possible add  this piece of simple code to limit the words number to a certain value (add this immediately after the above code or in place of the above code if you like to add only this part and like to use the external file with unwanted words list):

$ca = array_count_values($keywords);
if( $ca > 45 ){
$keywords = array_slice($keywords, 0, 45); // return output of 45 words

Bookmark and Share

Tags: , , , , , , , , ,

11 Responses to “Zikula SEO – the meta keywords function hacking”

  1. w3it.org – Internet Helper » Blog Archive » Zikula SEO – the meta … Hello CMS - the best cms website Says:

    [...] the rest here: w3it.org – Internet Helper » Blog Archive » Zikula SEO – the meta … By admin | category: Object, Zikula | tags: easy-extension, object-oriented, [...]

  2. Georgia Says:

    There is obviously a lot to know about this. I think you made some very valid comments.

  3. Sadie Says:

    I snagged this, looks good. I also subbed to your feed. I like your site, handy stuff here. I especially like the Open ports utility which I will also grab.

  4. Bay Area Web Design Says:

    As a graphic web designer , I’m extremely glad to see that someone brought up this topic.

    All too many people out there just don’t grasp the concept of what all is needed in this industry, and I think also we’re all too often not appreciated enough
    or taken for granted. Never the less I’m glad to see that you feel the same way I do , thanks so much for your blog!

  5. youproblog Says:

    Hi, I found your blog on google. I’m pretty glad to have found your blog because I think it is interesting! I will definitely come back! Great resource for my students. Youproblog

  6. Adam Says:

    Hello. Great info. Do you accept guest bloggers?

  7. Robyn Says:

    Hey. Do you accept guest bloggers? How do I submit a post?

  8. axew3 Says:

    you can register on forum (simply click register from any link available at w3it.org) than go to post every you like, any part of w3it.org. Welcome Robyn! Welcome to all, and thank, many more info will become available for all as soon about zikula and others cms, wp, vb, phpbb etc … :)

  9. BlackhatApproved Says:

    BTW, after months of reading this blog, I just had to comment on this one. What’s up with that?

  10. humle30 Says:

    Hi

    Tried to add this:

    $dk = array_keys($keywords);
    foreach($dk as $d) {
    $ln = strlen($keywords[$d]);
    if ($ln < 3) {
    unset($keywords[$d]);

    Did not work, so i removed the first 2 lines and there was no error anymore, but the keywords are still 2 and letters. Is there any update in this hack?

  11. jagpreet Says:

    looks good. I also subbed to your feed. I like your site, handy stuff here. I especially like the Open ports utility which I will also grab.

Leave a Reply