PDA

View Full Version : Meta Tags php includes


urbanrays
04-07-2011, 08:03 PM
Hi

Just been checking on Google Webmaster tools and I have seen that it is picking me up for "Duplicate Meta Tag Info".

The trouble is I am using php includes so how do I create different meta descriptions for each page.

Thanks in advance

gentleone
04-07-2011, 08:45 PM
You shouldn't include whole pages in the first place. Includes are meant to include snippets of code.

urbanrays
04-07-2011, 09:16 PM
You shouldn't include whole pages in the first place. Includes are meant to include snippets of code.

Thanks for the patronising, constructive help! It was inspirational

I have just copied how I have done it with my title text, right or wrong it works so it will do me.

I put this in my header
<meta name="description" content="<?php echo $description;?>">
<meta name="keywords" content="<?php echo $keywords;?>">

and this at the top of each of my pages

<?php
$description="My Description Here.";
$keywords="My keywords here";
include('header.php');
?>

edbr
04-08-2011, 01:50 AM
im assuming this is a dynamic database site. you can in that case use info from the database to do this. using a unique description for any page
<meta name="description" content="<?php echo $row{'description'];?>">

domedia
04-08-2011, 03:44 PM
Thanks for the patronising, constructive help! It was inspirational I think you read too much into that :-)
He's trying to say it's a bad idea, and basically Google told you that as well.
You'll actually be better off not including any meta description/keywords at all compared to having the same ones on all the pages.

Ricky55
04-08-2011, 07:34 PM
I use includes to include the whole of the header and the whole of the footer just leaving any unique content on each page.

I then you use PHP to generate my page titles from the file name and also to style my menu bar down states.

On a site I'm doing at the moment it works great, the site loads very quickly. My header.php goes from the doctype right covers all my nav and then to the opening of my main content div.

I wasn't aware that it was bad practice to have the same meta data on each page.

For the meta description I always specify what the company does in a paragraph and for the keywords I use around 15 to 20 but these make sense on each page.

I'll have to start changing them. If its not good practice.

Your method seems fine though Urban. Thats how I would do it.

Ricky55
04-08-2011, 07:37 PM
BTW Gentle is not patronising you mate. None of the regulars on here come on to patronise they just like helping people. Well that's why I come on anyway.

Ricky55
04-08-2011, 07:50 PM
http://googlewebmastercentral.blogspot.com/2009/09/google-does-not-use-keywords-meta-tag.html

Seems description is the key meta tag.

Dom can you be penalised then for using the same meta description on each page?

gentleone
04-08-2011, 09:34 PM
Thanks for the patronising, constructive help! It was inspirational
It was not my intention to patronize you and I apologies if my post made you feel like that. It just came out all wrong what I tried to say...

DWcourse
04-08-2011, 11:51 PM
gentleone - Neither the description or the keywords meta tag is use by the major search engines to help determine your ranking in search results. The description tag is sometimes used as the description that appears in the search results (although often a snippet from the page containing the search term is used). So you description should be something unique to the page and that would encourage searchers to click on your link in the search results. The keyword tag you can totally ignore.

edbr
04-11-2011, 03:55 AM
Dom can you be penalised then for using the same meta description on each page?
cant be sure about penalise but google doesnt seem to like it ands advises against it. the point of description being about the page though, i suspect does have an influence, despite many opinions to the contrary as dwcourse says.
i like to pair important words in the content with words in the description although this may well be wishful thinking on my part

domedia
04-11-2011, 03:11 PM
Dom can you be penalized then for using the same meta description on each page?

Not as far as I know. Google ignores all meta tags when it comes to determining placement in the SERP's.