Control of meta description - categories

Register an Account
Pligg Chat Room
Reply
 
LinkBack Thread Tools Display Modes
  #61 (permalink)  
Old 10-04-2008, 01:04 PM
New Pligger
 
Join Date: Aug 2008
Posts: 13
I'm using 9.9.5 (I suspect the following is also applicable to 9.9) and the solution to making the meta description and keywords dynamic is already built in, but through Pligg itself there is no way to enter the description and keywords.

All you have to do is enter the description and keywords directly in the pligg_categories table (fields are category_desc and category_keywords) AND, VERY IMPORTANTLY clear the cache folders (cachte and templates_c). You'll need phpadmin or the mysql administration to enter data directly into the database.

No changes to the Pligg yget template are required.
Reply With Quote
  #62 (permalink)  
Old 10-10-2008, 02:30 PM
Casual Pligger
 
Join Date: Jul 2007
Posts: 34
did you done this method ?
if yes can you show your site to me
Reply With Quote
  #63 (permalink)  
Old 10-10-2008, 02:40 PM
New Pligger
 
Join Date: Aug 2008
Posts: 13
@sb225: Yes, I have done this. It is really very simple. Our site is not yet released so I cannot give you the real url yet.
Reply With Quote
  #64 (permalink)  
Old 10-16-2008, 01:02 AM
Casual Pligger
 
Join Date: Jul 2007
Posts: 34
thanks for this it is not in 9.9.0 only it applicables to 9.9.5 no upgraded and checked the database
Reply With Quote
  #65 (permalink)  
Old 11-23-2008, 07:37 PM
New Pligger
 
Join Date: Oct 2008
Posts: 8
Hi, I've tried this fix but it's not working for me. No matter what category I choose I still get the same meta title. The meta title will display as:

[entered keyword] | [category name]

It looks like the hack ignores what category page I'm on and just goes to the last if statement option.

Can anyone help with this?
Reply With Quote
  #66 (permalink)  
Old 11-06-2009, 07:10 PM
raghhav's Avatar
Casual Pligger
Pligg Version: 1.0.3
Pligg Template: Wison - Combin
 
Join Date: Oct 2009
Location: Mumbai
Posts: 74
Quote:
Originally Posted by blaze View Post
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.

Hi Blaze can you help me for 1.0.1 version please, am having bad time with dup description, kindly help on urgent basis.
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