Best Method for Dynamic Meta Tags

It’s not an urgent issue but in Google Webmaster it shows me as having duplicate meta tags on some pages, all of which are dynamic. So for example I have:

News Content Page 1
News Content Page 2
News Content Page 3
–News Story 1
–News Story 2
–News Story 3

Now I’ve managed to sort out dynamic titles for each page, that isn’t too much of an issue but its the meta tags I can’t think of the best way to deal with.

I tried this first:

				$rand=rand(1,3);
				switch($rand)
				{
					case 1:
						$keywords="compensation news, injury, work accident, road traffic accident, slip, trip, fall, fatal injury, medical negligence ";
					break;
					case 2:
						$keywords="personal injury news, work injury, road traffic accident, slip, trip, fall, medical negligence";
					break;
					case 3:
						$keywords="personal accident news, fatal injury, work accident, work illness, road traffic accident, broken bone, lost limb, professional negligence";
					break;
				}

But it doesn’t offer much variation, 10 out of 22 pages had the same Meta tags. I could obviously add more alternatives but it doesn’t seem to me as the best method.

I tried this:

$description="The latest compensation news | ".$title;
					$keywordArray = array("injury","work accident","road traffic accident","slip","trip","fall","fatal injury","medical negligence","personal injury news","work injury", "personal accident news","work illness", "broken bone","lost limb","professional negligence","back injury","brain injury");
					
					$i=1;$keywords = "compensation news";
					$deadWords = array("compensation news");
					while($i<=6) {
						$rand = rand(0,(count($keywordArray)-1));
									if(!in_array($keywordArray[$rand],$deadWords)) {
										$deadWords .= $keywordArray[$rand];
										$keywords .= ",".$keywordArray[$rand];
									}
								
							$i++;
					}

As far as I’m aware, it may not be the cleanest way to do it but that should work. But it just throws up an error that the second input for ‘in_array’ isn’t valid, but it is an array. Searching for reasons this error pops up only indicate that it means the datatype being used isn’t an array but it at least SHOULD be an array.

So the only other alternative I can think of is to alter my database to create a tags column and adding individual tags to news stories as and when necessary. This seems like a good method to me since it creates tags specific to each news story but it doesn’t solve the issue of the same tags appearing on multiple news list pages.

So are there any members here who have experience with this? I’m leaning towards the database method though I prefer to keep it all on the PHP side if possible.

First of all meta KEYWORDS are irrelevant and completely disregarded by major search engines. You can remove them without a second thought.

As for a meta description it has minimal impact on rankings, but can be helpful to get the description you want on the SERP, potentially helping click through rates. The description should be page specific though. No point generating a random one, or cycling through a set of them based on the topic of your whole site.
If you really want to set a meta description you should save on the in the database to be served with each page. If that’s too much trouble, just remove them too and the search engines will try to automatically determine one from the page content.

I’ve sorted out dynamic descriptions for each page, its just the ones where its page, 1, 2, 3 of a particular page that causes issues.

So they’re really not worth bothering with? Why does Google bother warning me about duplicate tags? Seems fear-mongering to do so if Google doesn’t care.

If the warning is about meta keywords, and not some other meta tag then it is unnecessary.
Here is a post on Matt Cutts’ blog about the issue: http://www.mattcutts.com/blog/keywords-meta-tag-in-web-search/

He’s the head of Google’s anti-spam team.

On my pages I include the page number as so…

description = “some description here | page 1” />

and so on. Same for titles.

Thanks,
Kevin