Fix duplicate meta description errors in sNews with this quick hack
Here's a nifty trick that I discussed recently in the comment section of one of my posts, but I think it's worth-while enough to bring to the front page on it's own.
You may have noticed that all the default "hard-coded" pages (archive, contact, sitemap) have the same meta description as the default for the website, this can cause duplicate meta errors to show up in Google's Webmaster Tools, and otherwise annoy SEO junkies. To fix this, BACK-UP your snews.php file, find the function title() and insert the following highlighted code;
function title() {
global $categorySEF, $_DESCR, $_KEYW, $_TITLE, $_NAME, $_XNAME;
echo '<base href="'._SITE.'" />';
$url = explode('/',clean(cleanXSS($_GET['category'])));
if ($url['0'] == "tag" || $url['0'] == "search") {
$title = $url['1'].' - ';
} else {
$title = $_TITLE ? $_TITLE.' - ' : '';
}
switch ($url['0']) {
case "tag":
$_DESCR = "Viewing all entries tagged with the term; ".$url[1];
break;
case "tags":
$_DESCR = "Overview all of tags used on the site"; // for tag overview, coming soon ;)
break;
case "search":
$_DESCR = "Searching results for all items containing the term(s); ".$url[1];
break;
case "archive":
$_DESCR = "View previous entries by date.";
break;
case "contact":
$_DESCR = "Contact the website operator.";
break;
case "sitemap":
$_DESCR = "Sitemap tree of all pages and articles on this site.";
break;
}
$title .= $_NAME ? $_NAME.' - ' : '';
$title .= $_XNAME ? $_XNAME.' - ' : '';
This also puts search terms and tags in the title, if you're using my SEO search mod or Tags mod. You may also want to change the language for the descriptions to your native tongue, and then upload your modified snews.php file and you should be all set.
CommentsComments RSS
I don't think that the descriptions are as important as site content and external links to your site when it comes to SEO but seeing errors on the google webmaster page is unnerving and such a simple fix is appreciated.
I'm no SEO expert, so yeah, I don't know if it really matters as far as SERPs or anything goes, but I always tweak when GWT displays a number under the "issues" section of the content analysis, :P
The best part? I just checked mine, I have a new one... the "All items tagged with;" I put above is too short! Hahaha, I can't win!
So I just changed it to "Viewing all entries tagged with the term;" in my snews.php, we'll see if that soothes Google.
thanks for this, although as far as I can see it has been integrated into 1.7. It would be nice to have a proper Meta Description and Keyword field for Categories however. I have used the description field there for the meta description, but probably will need to add an extra meta_keywords field to the DB etc. to stop snews from taking the keywords from the main settings page.
Your page does not seen to have this problem. Have you fixed this issure for yourself?
best
Tina
I don't believe this has been integrated into sNews 1.7 at all, I have a test site running the latest 1.7 release (Update 1.5) and all the hard-coded pages (sitemap, contact,etc) still use the default site description.
As to my "fix" for categories keywords/descriptions... I haven't really fixed much :/
The categories by default use the description for each category and insert that as the meta description.
My category meta keywords are still the same default "site setting" keywords.
You are correct though, there needs to be a proper meta keywords field added to the DB for each category. If I get around to fixing this, I'll certainly post the how-to.
yes, I checked the orignal 1.7 again and as you say it's not implemented. I suppose I got confused. I have another hack implement which allows me to see the contact, sitemap, archive pages as "Pages" which I can thus edit. Thus, I can define META descs and META keywords for those. However, this is not the case for categories. I realise you mod above does more than just adding META Desc for those originally hard-coded pages.
It would be great, if you find the time to publish your mod for category META Keywords :)
At this point, I'd like to say ... Thank you very much for your great page and the hard work you have put into optimizing snews. Your hacks and mods have helped me a lot (I currently use the search engine mod, the archive mod etc.) and make it real fun to work with snews. Thank you so much for this :)
http://www.mdj.us/snews-cms/hacks-mods/add-meta-keywords-to-your-categories-in-snews-17/
And thanks for the kind words, I do appreciate it :)
http://teknologi.bintang9.co.cc/web/funny-logo-search-engine/
http://teknologi.bintang9.co.cc/web/funny-logo-search-engine
How can prevent it?
You need to re-direct the url, try this;
http://www.mdj.us/web-development/force-the-trailing-slash-on-your-urls-with-modrewite-and-htaccess/
Cheers, Gerry
Yes, the above only works if you're using the "SEO search mod".
You could do it for the default sNews install by checking for the search_query variable. Something like;
if ($_POST['search_query']) {
$_DESCR = "Searching results for all items containing the term(s); ".cleanXSS($_POST['search_query']);
}
Cheers, Gerry
That's just the default way sNews does it. It's all in the above mentioned title function if you want to re-arrange things, it shouldn't take too much effort I wouldn't think.
--Matt