Control of meta description - categories

Register an Account
Pligg Chat Room
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-21-2007, 07:44 AM
Divisive Cotton's Avatar
Pligg Donor
 
Join Date: Sep 2007
Posts: 197
I'm sure this has been brought up before but it would be good to have control of the meta description for categories.

At the moment it is the default.
Reply With Quote
  #2 (permalink)  
Old 12-21-2007, 08:26 AM
Pligg Donor
Pligg Version: 9.9.5
 
Join Date: Sep 2007
Posts: 192
Quote:
Originally Posted by Divisive Cotton View Post
I'm sure this has been brought up before but it would be good to have control of the meta description for categories.

At the moment it is the default.
I mentioned this too.

This is very detrimental to the success of good SEO. I would be willing to pay for this mod and share it with the community. I have contacted Ashdigg to see if he can develop this, but have heard nothing back from him. He's likely very busy right now. I'll pay anyone to get this working. Just send me a private message and let me know.
Reply With Quote
  #3 (permalink)  
Old 12-24-2007, 12:21 AM
Pligg Donor
Pligg Version: 9.9.5
 
Join Date: Sep 2007
Posts: 192
Note: This fix is for v 9.82 AND v 9.9.0

Ok, well here is a TEMPORARY SOLUTION that I worked on. It took me a while to figure out how to tweak this just right, but it does work. It ain't pretty to look at and it also takes a lot of work if you have lots of categories... but here goes:

In v 9.82, look for this code in index.php:

Code:
if(isset($_REQUEST['category'])){
	$thecat = $db->get_var("SELECT category_name FROM " . table_categories . " WHERE `category_safe_name` = '".urlencode(sanitize($_REQUEST['category'], 1))."';");
}
and change it to:

Code:
// find the name of the current category

if(isset($_REQUEST['category'])){
	$thecat = $db->get_var("SELECT category_name FROM " . table_categories . " WHERE `category_safe_name` = '".urlencode(sanitize($_REQUEST['category'], 1))."';");
	$main_smarty->assign('category', $thecat);
}
If you are using v 9.9.0, then find this in index.php:

Code:
// find the name of the current category
if(isset($_REQUEST['category'])){
	$thecat = get_cached_category_data('category_safe_name', urlencode(sanitize($_REQUEST['category'], 1)));
	$thecat = $thecat->category_name;
}
and change it to this:

Code:
// find the name of the current category
if(isset($_REQUEST['category'])){
	$thecat = get_cached_category_data('category_safe_name', urlencode(sanitize($_REQUEST['category'], 1)));
	$thecat = $thecat->category_name;
	$main_smarty->assign('category', $thecat);
}
Now the rest of the instructions should be the same for both versions 9.82 and 9.9.0.

Open your meta.tpl file and find this:

Code:
{if $meta_description neq ""}
<meta name="description" content="{$meta_description}" />
{else}
<meta name="description" content="Pligg Content Management System" />
{/if}

{if $meta_keywords neq ""}
<meta name="keywords" content="{$meta_keywords}, Pligg Content Management System" />
{else}
<meta name="keywords" content="Pligg Content Management System" />
{/if}
Replace with this:

Code:
{if $pagename eq "published"}
{if $category eq "Category 1"}
<meta name="description" content="My published category 1 description." />
<meta name="keywords" content="My published category 1 keywords go here" />
{elseif $category eq "Category 2"}
<meta name="description" content="My published category 2 description." />
<meta name="keywords" content="My published category 2 keywords go here" />
{elseif $category eq "Category 3"}
<meta name="description" content="My published category 3 description." />
<meta name="keywords" content="My published category 3 keywords go here" />
{elseif $category eq "Category 4"}
<meta name="description" content="My published category 4 description." />
<meta name="keywords" content="My published category 4 keywords go here" />
{else}
<meta name="description" content="My default index page (or published stories) description." />
<meta name="keywords" content="My default (index page) published content keywords go here" />
{/if}
{elseif $pagename eq "upcoming"}
{if $category eq "Category 1"}
<meta name="description" content="My upcoming category 1 description." />
<meta name="keywords" content="My upcoming category 1 keywords go here" />
{elseif $category eq "Category 2"}
<meta name="description" content="My upcoming category 2 description." />
<meta name="keywords" content="My upcoming category 2 keywords go here" />
{elseif $category eq "Category 3"}
<meta name="description" content="My upcoming category 3 description." />
<meta name="keywords" content="My upcoming category 3 keywords go here" />
{elseif $category eq "Category 4"}
<meta name="description" content="My upcoming category 4 description." />
<meta name="keywords" content="My upcoming category 4 keywords go here" />
{else}
<meta name="description" content="My default upcoming stories description." />
<meta name="keywords" content="My default upcoming stories keywords go here" />
{/if}
{elseif $pagename eq "story"}
<meta name="description" content="{$navbar_where.text2} - {$meta_description}" />
<meta name="keywords" content="{$meta_keywords}, add some extra default keywords here" />
{elseif $pagename eq "search"}
<meta name="description" content="Search Results For {$templatelite.get.search|sanitize:2|stripslashes} {$from_text} - My default search description." />
<meta name="keywords" content="{$templatelite.get.search|sanitize:2|stripslashes} {$from_text}, add some extra default keywords here" />
{elseif $pagename eq "cloud"}
<meta name="description" content="My default tag cloud description." />
<meta name="keywords" content="My default cloud keywords go here" />
{else}
<meta name="description" content="{$meta_description}" />
<meta name="keywords" content="{$meta_keywords}" />
{/if}
In the above example, you can add more categories (or subcategories) by adding as many {elseif} statements as you like (one per category or subcategory), just follow the sequential order. Also, don't forget to replace the "Category 1" "Category 2" etc. with your real category names. Obviously, replace the description tags and meta keyword tags with your own data as well.

For Unique titles, I have done the following:

open Pligg.tpl file and find:

Code:
<title>{if isset($pretitle)}{$pretitle}{/if}{#PLIGG_Visual_Name#}{if isset($posttitle)}{$posttitle}{/if}</title>
Replace with:

Code:
{if $pagename eq "published"}
{if $category eq "Category 1"}
<title>{if isset($pretitle)}{$pretitle}{/if}My Custom Published Category 1 Title</title>
{elseif $category eq "Category 2"}
<title>{if isset($pretitle)}{$pretitle}{/if}My Custom Published Category 2 Title</title>
{elseif $category eq "Category 3"}
<title>{if isset($pretitle)}{$pretitle}{/if}My Custom Published Category 3 Title</title>
{elseif $category eq "Category 4"}
<title>{if isset($pretitle)}{$pretitle}{/if}My Custom Published Category 4 Title</title>
{else}
<title>{if isset($pretitle)}{$pretitle}{/if}Good Keyword Phrase Here{if isset($posttitle)} | {$navbar_where.text1} | {$navbar_where.text2}{/if}</title>
{/if}
{elseif $pagename eq "upcoming"}
{if $category eq "Category 1"}
<title>{if isset($pretitle)}{$pretitle}{/if}My Custom Upcoming Category 1 Title</title>
{elseif $category eq "Category 2"}
<title>{if isset($pretitle)}{$pretitle}{/if}My Custom Upcoming Category 2 Title</title>
{elseif $category eq "Category 3"}
<title>{if isset($pretitle)}{$pretitle}{/if}My Custom Upcoming Category 3 Title</title>
{elseif $category eq "Category 4"}
<title>{if isset($pretitle)}{$pretitle}{/if}My Custom Upcoming Category 4 Title</title>
{else}
<title>{if isset($pretitle)}{$pretitle}{/if}My Default Upcoming Stories Title</title>
{/if}
{elseif $pagename eq "story"}
<title>{if isset($pretitle)}{$pretitle}{/if}Different Good Keyword Phrase Here | {$navbar_where.text1}  | {$navbar_where.text2}</title>
{elseif $pagename eq "search"}
<title>{if isset($pretitle)}{$pretitle}{/if}Another Good Keyword Phrase Here | Search Results For {$templatelite.get.search|sanitize:2|stripslashes} {$from_text}</title>
{elseif $pagename eq "cloud"}
<title>{if isset($pretitle)}{$pretitle}{/if}Yet Another Good Keyword Phrase Here | Most Popular Tags</title>
{else}
<title>{if isset($pretitle)}{$pretitle}{/if}{#PLIGG_Visual_Name#}{if isset($posttitle)} | {$navbar_where.text1} {/if} | {$navbar_where.text2}</title>
{/if}
Just like the description and keyword tags, you can add more {elseif} statements for more categories and/or subcategories. The above title fix gives you more control than some of the other recommended fixes throughout the forum. Again, don't forget to replace the "Category 1" "Category 2" etc. with your real category names, as well as change the titles to whatever you want.

You can, of course, tweak this code to suit your own needs if you're advanced enough to figure it out; but if used as above, they should be pretty darn good the way they are for good SEO. I hope this is helpful for some of you -- because for me, it was a relief to finally have SOME control over the meta data and titles for categories.

Duplicate content should not occur, because essentially the home page consists of ALL POPULAR STORIES , whereas the CATEGORY PAGES contain only popular pages within that one particular category, so it will show different stories in a different order, and will be updated less frequently than the home page. Think of it like being a sorting option.

But to play it safe, I would remove the sidebar modules for each of the individual published category pages and change the footer for each of the different category pages to make the layout be more UNIQUE, thereby really making it different from the home page for both search engines and humans.

Last edited by blaze; 01-24-2008 at 04:27 AM. Reason: I edited the above code to replace two {if} statements with {elseif} statements in the Title fix.
Reply With Quote
  #4 (permalink)  
Old 12-25-2007, 01:38 AM
not2serious's Avatar
Pligg Donor
Pligg Version: v0.96 w/modifications
Pligg Template: Yget w/modifications
 
Join Date: Apr 2007
Location: East Coast, USA
Posts: 205
Thanks blaze, I will implement this mod the next time I do a larger update. Please keep us posted if there are any changes or improvements. PS: for some reason the "Thank" button is not available.
Reply With Quote
  #5 (permalink)  
Old 12-26-2007, 02:54 PM
wwwSENSERELYcom's Avatar
Casual Pligger
 
Join Date: May 2007
Location: Tianjin, China
Posts: 67
can you give the change you've made to handle this, blaze? Thanks!
Reply With Quote
  #6 (permalink)  
Old 12-26-2007, 05:13 PM
Pligg Donor
Pligg Version: 9.9.5
 
Join Date: Sep 2007
Posts: 192
Quote:
Originally Posted by wwwSENSERELYcom View Post
can you give the change you've made to handle this, blaze? Thanks!
The change has already been included above. Basically, I discovered that the index.php page never had $main_smarty->assign('category', $thecat); added to it, yet the upcoming.php file did have this in there. This is why the {if $category eq "my category"} string wouldn't work for published category pages, yet it would work for upcoming category pages. The index.php file was missing the variable. I simply added it in there.

Got it?
Reply With Quote
  #7 (permalink)  
Old 12-26-2007, 05:26 PM
wwwSENSERELYcom's Avatar
Casual Pligger
 
Join Date: May 2007
Location: Tianjin, China
Posts: 67
Thanks, I got it. I thought you said you made the change to the code above, but on your site, not on the actual post.. It's very useful to be able to laser-target the categories pages with description and keywords tags. At least the most important ones.
Reply With Quote
  #8 (permalink)  
Old 12-26-2007, 06:27 PM
Pligg Donor
Pligg Version: 9.9.5
 
Join Date: Sep 2007
Posts: 192
Quote:
Originally Posted by wwwSENSERELYcom View Post
Thanks, I got it. I thought you said you made the change to the code above, but on your site, not on the actual post.. It's very useful to be able to laser-target the categories pages with description and keywords tags. At least the most important ones.
Yes, now there should be NO EXCUSES for any site not placing a top ten listing in Google! (Ha!)
Reply With Quote
  #9 (permalink)  
Old 12-29-2007, 05:46 PM
New Pligger
Pligg Version: 9.8.0
Pligg Template: hacked yget
 
Join Date: Nov 2007
Location: Savannah GA
Posts: 22
Hmm, this is weird... not working for me. Any change I make to meta.tpl screws my site and displays a white page for every link I go to.

Any ideas? I will provide any info if you wish to provide a little support.
Reply With Quote
  #10 (permalink)  
Old 12-30-2007, 01:34 AM
Casual Pligger
Pligg Version: 9.9.5
Pligg Template: custom yget
 
Join Date: Jun 2007
Location: Colorado
Posts: 66
Quote:
Originally Posted by blaze View Post
Yes, now there should be NO EXCUSES for any site not placing a top ten listing in Google! (Ha!)
Indeed Blaze. I run this up on one of our test sites (9.8.2) and it works perfectly. Great job!

Fighting duplicate content is number one on our list. I'm sure wishing that this had been solved way back before we created 75+ categories/subs and got indexed by G. It appears I have a lot of work to do.

G reports 439 duplicate page titles out of 4400...argh...10%

Any ideas on how to 301 redirect my_story_title to my-story-title for over 3500 submissions?!? I followed your blog for that fix, although it doesn't work for me yet it is an imperative move before you have thousands of submissions online :-)

Just kidding with the idea thing, very tall order that ma not possibly be remedied with such a large site but invaluable knowledge when it comes to launching others.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in Story Meta Description ffarhann Questions and Comments 3 01-26-2010 02:58 PM
Meta Description Problems HelloKitty Questions and Comments 1 11-24-2009 03:04 AM
Meta Tagging Categories Properly? Andromedan Questions and Comments 1 04-04-2008 03:46 PM
Setting default meta description Biomech Questions and Comments 9 10-03-2007 01:08 PM
Dynamic meta description tag generation fix creep Questions and Comments 2 03-17-2007 10:32 AM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development