1
jeffgr
Easiest way to add custom page title, keywords & description to blank module?
  • 2007/9/11 17:20

  • jeffgr

  • Quite a regular

  • Posts: 263

  • Since: 2004/2/22


Hi everyone,

I am using the PageWrap module to display static HTML pages within my XOOPS site. Here is the code of the index.php file of this module:


<?php
include("../../mainfile.php");
include(XOOPS_ROOT_PATH."/header.php");
$xoopsOption['show_rblock'] = 1;
?>
My HTML page content goes here.
<?php
include(XOOPS_ROOT_PATH."/footer.php");
?>


This works for me quite well, and I end up with a custom page module that looks like this:

http://xoopsexperts.com/modules/about/

I have renamed the module to be "about" in this case, and changed the xoops_version.php file to reflect this directory name change.

What I want to know is... how can I give this custom module it's own unique page title, meta keywords, and page meta description tag?

I don't want to add these tags onto the title, keywords or description tags that I use on the rest of the site...I just want this module to have it's own unique tags.

Any ideas on the easiest way to do this? I think I need to bypass the header.php file... or is there someway to "override" the main meta tags?

Thanks,

Jeff

2
martyboy
Re: Easiest way to add custom page title, keywords & description to blank module?
  • 2007/9/11 17:37

  • martyboy

  • Quite a regular

  • Posts: 256

  • Since: 2004/5/25


You can use the mypage module which I think is what you are using now? use the php code you have already which wraps the XOOPS header/footer, etc but place it between the <body></body> tags of a blank html page and you can add your custom page title, metatags, etc to each page. You can add the xoops_sitename tag however so you need to add your sitename manually if thats what you want you also need to add the modules name manually as this method seems to override the modules name which would normally appear in the title.

You can see an example on my site HERE as you can see each page has a different title.

I hope this what you are looking for, hopefully i havent misunderstood.
Michael Jackson = King Of Pop

Xoops = King Of CMS

3
jeffgr
Re: Easiest way to add custom page title, keywords & description to blank module?
  • 2007/9/11 18:01

  • jeffgr

  • Quite a regular

  • Posts: 263

  • Since: 2004/2/22


Hi martyboy,

I did try that actually...adding in the meta tags to the HTMl information that that goes in the middle of the PageWrap script. And you can indeed see these tags when you look at the source code of the page. However, I don't think that search engines are actually reading these tags as "the" meta tags that apply to that page...as they aren't the meta tags that are applied by the header.php file.

If you look at the source code of:

http://xoopsexperts.com/modules/about/

You will see that there are two instances of the meta tags...the first ones, at the top, are the site-wide tags. You can see further down in the code the meta tags that I inserted into the HTML content. However, I think that this second set of meta tags is disregarded by search engines. It doesn't seem to be the tags that the search engine is using for it's title, keywords or description tag. I think I need to overwrite these site-wide meta tags somehow. This is what I am trying to figure out.

Thanks,

Jeff

4
jeffgr
Re: Easiest way to add custom page title, keywords & description to blank module?
  • 2007/9/12 12:54

  • jeffgr

  • Quite a regular

  • Posts: 263

  • Since: 2004/2/22


Admins - Please remove the three posts above, they are obviously spam (to drop links to his sites!).

Othere then that...does anyone have any ideas on how to do this? Adding in these three meta tags to this blank module would REALLY help with the SEO of the module that you are making. I can think of a way to do this, whereby you would refer to a header.php file that is contained within the module....but I have a feeling that this isn't the most effective way to accomplish this task! Any other ideas?

5
iHackCode
Re: Easiest way to add custom page title, keywords & description to blank module?

for my XOOPS 2.0.17 site i use something like.. to change the keywords and description.

if(isset($xoTheme) && is_object($xoTheme)) {
   
$xoTheme->addMeta'meta''keywords'"word, xoops, bandit-x");
   
$xoTheme->addMeta'meta''description'"my page of .. something");
}
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

6
jeffgr
Re: Easiest way to add custom page title, keywords & description to blank module?
  • 2007/9/12 14:44

  • jeffgr

  • Quite a regular

  • Posts: 263

  • Since: 2004/2/22


That works to change the meta keywords & description, thanks!

Bu what about the page title tag? At the moment, I have this code, which I am including in the blank module index page:

$xoopsTpl->assign('xoops_pagetitle', 'this is my page title');

This seems to add on the "this is my page title AFTER the default XOOPS site-wide page title.

But how might I remove the site-wide page title from showing, so that I only see the custom title that I add for this page

(which will give better SEO results)

Thanks,

jeffgr

7
iHackCode
Re: Easiest way to add custom page title, keywords & description to blank module?

$xoopsTpl->assign('xoops_sitename','');


most themes use both tags in the title. but you may also have an - before your title . due to the theme.
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

8
jeffgr
Re: Easiest way to add custom page title, keywords & description to blank module?
  • 2007/9/12 16:39

  • jeffgr

  • Quite a regular

  • Posts: 263

  • Since: 2004/2/22


Yes, this worked, thanks!

So...this is the code that I am now using in my index.php file:

<?php
if (file_exists("mainfile.php")) {
include(
"mainfile.php");
} elseif (
file_exists("../mainfile.php")) {
include(
"../mainfile.php");
} else { 
include(
"../../mainfile.php");
}
include(
XOOPS_ROOT_PATH."/header.php");
$xoopsTpl->assign'xoops_showrblock'1); // 1 = With right block - 0 = Without right block
$xoopsTpl->assign'xoops_showlblock'0); // 1 = With left block - 0 = Without left block
?>

HTML CONTENT GOES HERE

<?php

if(isset($xoTheme) && is_object($xoTheme)) {
   
$xoTheme->addMeta'meta''keywords'"keyword, keyword, keyword, keyword");
   
$xoTheme->addMeta'meta''description'"This is the page description");
$xoopsTpl->assign('xoops_sitename','This is the page title');
   
}
include(
XOOPS_ROOT_PATH."/footer.php");
?>


Thanks again

jeffgr

9
jeffgr
Re: Easiest way to add custom page title, keywords & description to blank module?
  • 2007/9/12 19:55

  • jeffgr

  • Quite a regular

  • Posts: 263

  • Since: 2004/2/22


I have zipped up my version of the PageWrap module for you to download here:

http://xoopsexperts.com/modules/downloads/

My version of this module contains the code discussed in this thread, which will allow you to give the a unique page title, meta keywords, and meta description tag to the index.php file of this blank module. This will help you get the content that you put in this module to rank well with search engines.

I have also commented the code a bit more as well.

I renamed the module version 2.0 as well.

I added your name, Bandit-X, to the credits, hope you don't mind. :)

Enjoy!

jeffgr

10
jeffgr
Re: Easiest way to add custom page title, keywords & description to blank module?
  • 2007/9/21 19:55

  • jeffgr

  • Quite a regular

  • Posts: 263

  • Since: 2004/2/22


I just wanted to add on to this thread that I have seen a significant, positive change in my search engine results for pages in which I have used this new "blank module". Search engines really do like those page titles, keywords and page description tags...

jeffgr


www.XoopsExperts.com

Login

Who's Online

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


Members: 0


Guests: 145


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