XFG - Xoops For Google

Date 2005/12/6 18:00:00 | Topic: Hacks

Xoops For Google


Introduction
Actually, the few pages availables in the user side of your site(s) does not always offer a significative page title.
That's a problem because significatives pages titles, meta keywords and meta descriptions can help you to have better places in search engines results pages.

XFG (Xoops For Google) is a modified version of Xoops 2.0.13.2 wich add titles to the kernel's pages.
To the default modules wich are provided with Xoops, I have added pages titles and meta keywords and meta description when it was possible.

For memory, the metagen was created by Marcan and Solo.

I have also added, for example purpose, some modified modules.

You will find, later in this article, a complete list of the kernel's pages I have modified and the list of the modified modules.

The goal is not to give you a serie of modified modules but to give you some of them so that you can do it yourself and easily.

What whill you find in this package ?
As I said in the introduction, this package contains a complete modified version of Xoops 2.0.13.2 and some modified modules.

It's an installable version of Xoops that you will find in the zip file.

You can then use it to create new websites.
You will also find the french translations of Xoops and of the modules.



Kernel modified pages
The following pages (wich you can find at the root of your webiste) was modified :
edituser.php (I have added a page's title)
notifications.php (I have added a page's title)
readpmsg.php (I have added a page's title)
register.php (I have added a page's title)
search.php (I have added a page's title)
user.php (I have added a page's title)
userinfo.php (I have added a page's title)
viewpmsg.php (I have added a page's title)



How to detect changes in the code ?
All the modifications to the code are delimited with the two following comments :
Quote:

// Hack made by Hervé Thouzard (http://www.herve-thouzard.com)
...
code
...
// End Hack

So it will be easy for you to find them.



Modified modules
- Contact
Nothing (it was not necessary)

- Mydownloads
brokenfile.php (I have added a page's title, meta keyword and meta description)
index.php (I have added meta keywords and description)
modfile.php (I have added a page's title, meta keyword and meta description)
ratefile.php (I have added a page's title, meta keyword and meta description)
singlefile.php (I have added a page's title, meta keyword and meta description)
submit.php (page's title and meta description)
topten.php (page's title and meta description)
viewcat.php (I have added a page's title, meta keyword and meta description)

- Mylinks
brokenfile.php (I have added a page's title, meta keyword and meta description)
index.php (meta keywords added)
modlink.php (I have added a page's title, meta keyword and meta description)
ratelink.php (I have added a page's title, meta keyword and meta description)
singlelink.php (I have added a page's title, meta keyword and meta description)
submit.php (page's title and meta description)
topten.php (page's title and meta description)
viewcat.php (I have added a page's title, meta keyword and meta description)

- Newbb 1
index.php (meta description added)
newtopic.php (page's title and meta description)
post.php (page's title and meta description)
reply.php (I have added a page's title, meta keyword and meta description)
search.php (page's title and meta description)
viewforum.php (I have added a page's title, meta keyword and meta description)
viewtopic.php (I have added a page's title, meta keyword and meta description)

- News 1.43
I did not made any change as the module already treat meta keywords, meta descriptions and pages titles.

- Section
index.php (I have added a page's title, meta keyword and meta description)

- XoopsFaq
index.php (I have added a page's title, meta keyword and meta description)

- XoopsHeadline
index.php (page's title and meta description)

- XoopsMembers
index.php (page's title and meta description)

- XoopsPartners
join.php (page's title and meta description)

- XoopsPoll
You can add a description per poll but it was not used.
Now poll's descriptions are visibles in the pages.
index.php (I have added a page's title, meta keyword and meta description)
pollresults.php (I have added a page's title, meta keyword and meta description)

- For example purpose, I have also added Agendax and Catads.
(I hope that their authors will not be in anger after me)
This is just to give you more examples of how to use it.



Download
You can download the package here



How does it run and how to extend this to some other modules ?
To the root of the site, you will find a file called xfg.php.
Include this file in all the pages you want to modify.
Except to include this file and to call some functions, you don't have to do anything else.
You just have to verify that the module you are modifying uses Xoops templates (Smarty)
The file have 3 functions :

- xoops_create_page_title(article, topic)
This function is used to create pages titles.
You can pass it two parameters but you can limit to one.
The principle is to create pages titles like this :
article - topic - module's name


- xoops_create_meta_description(content)
With this function that's the content of the meta description wich is created.


- xoops_create_meta_keywords(content)
Extracted from the News module version 1.43 (and a bit enhanced), this function enable you to create in an automatic way, keywords according to the content you gave it.

The function does not treat keywords shorter than (x) characters.
The length is the one you have declared in the general preferences of your website.
It means that every keywords shorter than this length will be ignored.
The function will only keep unique keywords and will not keep numbers.
Html codes are removed.

At the begining of the function, you will find two parameters you can modify so that you can modify the function's behaviour.

With the first parameter, $method you can choose a method to extract and select keywords order. With the second parameter, $keywords_count, you choose how many keywords to create.
I suggest you not to use a high number.


To come back to the first parameter, $method, you can use 3 different methods.
This parameter can be 1, 2 or 3 :

- 1 - Keywords are created in the same order as in the text.
The following text will give the following keywords (I suppose that keywords shorter than 3 characters are ignored).
text :
Quote:

You can find many modules on xoops.org.
Some of them are for Xoops 1 and some are for Xoops 2.
You can download them from sourceforge but also from the author's website.
Personally I prefer to download modules from author's website.
You can also find an excellent FAQ.

generated keywords :
Quote:

you,can,find,many,modules,xoops,org,some,them,are,for,and,download,from,sourceforge,
but,also,the,author,website,personally,prefer,excellent,faq


- 2 - Keywords order is made according to the reverse keywords frequency in the text.
So the less frequent words appear in first in the list. Still with the same text, keywords will be :
Quote:

the,personally,but,sourceforge,and,prefer,faq,excellent,org,many,website,find,modules,
author,for,them,download,are,some,also,you,xoops,from,can

the can word is the one you will find most often in the text, that's why it is placed at the end and that's why it is considered as the less significative.

- 3 - Same as previously, the only difference is that the most frequent words will appear in first in the list. So the keywords will be :
Quote:

you,xoops,from,can,for,download,are,also,website,them,modules,author,find,some,faq,personally,
prefer,excellent,org,many,but,sourceforge,and,the


Of the 3 methods, it's up to you to choose the one you want to use.
For myself, I prefer the first because keywords appear in a more natural order, the text's order.

If the function can't create keywords, then it will return the keywords defined in the Xoops general preferences.

Finally, if you wish to use those functions, you just have to place this code in your modules pages.

Quote:

// Hack made by Hervé Thouzard (http://www.herve-thouzard.com)
include_once XOOPS_ROOT_PATH."/xfg.php";
xoops_create_page_title($article, $topic);
xoops_create_meta_description($content);
xoops_create_meta_keywords($content);
// End Hack

Just replace the parameters with your own content.



Notes
- This method is not miraculous, the best method is to create pages titles and meta informations yourself. You can do it with some modules.
Meta keywords are less and less used by search engines (Google as the first)

- If I can find some time, I will add a blacklist system, where you could remove some keywords from being placed in the meta keywords.

- An object oriented approch should have been better (from a dev point of view) but in my opinion it will have been less easy to understand for non programmers.

Bye,
Hervé




This article comes from XOOPS Web Application System
https://xoops.org

The URL for this story is:
https://xoops.org/modules/news/article.php?storyid=2727