1

Topic: Meta Tags.... Again

I was reading another post in this forum called Meta Tags. I learned what I need to do with my meta tags but I have a question. Once I add the meta tags to main.tpl all the meta tags show up on the raw source of every page on my website. I want to add my meta tags but only want them on one page (ie: index.php). How should I go about doing this?

Thanks in advance for all your help...

Re: Meta Tags.... Again

What you need to do is to add a new replacement variable, e.g. <meta_tags> and then replace that tag with your actual data in header.php. Have a look in header.php to see how to do that.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

3

Re: Meta Tags.... Again

Rickard wrote:

What you need to do is to add a new replacement variable, e.g. <meta_tags> and then replace that tag with your actual data in header.php. Have a look in header.php to see how to do that.

I really don't understand what you are saying. I am new to this programming stuff. Please explain further.

Thanks in advance for all your help.

Re: Meta Tags.... Again

1. Add <mega_tags> somewhere in the head tag of your template.

2. Add the following right before the line "// START SUBST - <pun_main>" in header.php:

if (basename($_SERVER['PHP_SELF']) == 'index.php')
{
    $meta_tags = '
    <meta name="abstract" content="Blaha blaha." />
    <meta name="keywords" content="blaha, bla, ha" />
    ';
}
else
    $meta_tags = '';

$tpl_main = str_replace('<meta_tags>', $meta_tags, $tpl_main);

Not tested, but it should work.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

5

Re: Meta Tags.... Again

Rickard wrote:

1. Add <meta_tags> somewhere in the head tag of your template..

When you say add <meta_tags> somewhere in the head tag, which template are you referring to? main.tpl? or what?

Re: Meta Tags.... Again

Yes.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

7

Re: Meta Tags.... Again

After all that hard work I finally got it. The Meta Tags are in. Thanks to Rickard for all your help. It was easy to add. I thank you again.

Re: Meta Tags.... Again

Is it possible to have the post title also inserted into the description and keyword meta tags?
This seems to get posts into the search engines and bring traffic to sites.