How to show category keywords as text on the site?

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 11-23-2008, 01:04 AM
Casual Pligger
 
Join Date: Apr 2008
Posts: 38
I want to show my category keywords as text on my website. I want to have the category keywords as textlinks at the bottom of each post on my frontpage. I have one link to Discuss, one link to Read More at the bottom of each post on the frpntpage. Now I want to have another link beside thoose links at the bottom of each post. That link shall lead to the category of the post and have text that is identical to the keywords belonging to that category. How can I make a text link that leads to a specific category and that uses the category keywords as link text.

For example, this link leads to the category of the post and shows the category link as text:

<a href="{$category_url}">{$link_category}</a>

I want my new link to be something like:

<a href="{$category_url}">{$category_keywords}</a>

Is it possible to use the category keywords as text in a link that leads to the same category as the keywords belong to?

My problem is that I don't want to show the category name as link text because the category name consists of non capital letters ans no space between words. I therefore tried to give each category a keyword and then use the keyword as link text.

category name: socialmedia
category keyword: Social Media

I want the last one to appear as visible text on my site, not the first one.

Well, that's my question. I hope I managed to describe my problem.

Last edited by gnalkit; 11-23-2008 at 01:11 AM.
Reply With Quote
  #2 (permalink)  
Old 11-23-2008, 06:16 AM
New Pligger
Pligg Version: 9.9.5
 
Join Date: Oct 2008
Posts: 2
Category names can contain spaces and other characters to make them suitable for normal display. Perhaps you could use more displayable names?

The category keywords are intended for inclusion in the HTML header as meta keywords for the category listing page.

If you really did want to include the category keywords in the listing for each story, you would need to edit libs/link.php and then link_summary.tpl in your template.

In link.php start by looking at print_summary(), but you probably really want to edit fill_smarty() in that file. This is where you need to add the category keywords to the smarty template, so that they are available for the link listing item.

Once you've made a variable available to smarty, then you can add it to your template to actually display it.

I would strongly suggest using more display friendly category names though - much, much easier!
Reply With Quote
  #3 (permalink)  
Old 11-23-2008, 02:31 PM
Casual Pligger
 
Join Date: Apr 2008
Posts: 38
Quote:
Originally Posted by spither View Post
Category names can contain spaces and other characters to make them suitable for normal display. Perhaps you could use more displayable names?

The category keywords are intended for inclusion in the HTML header as meta keywords for the category listing page.

If you really did want to include the category keywords in the listing for each story, you would need to edit libs/link.php and then link_summary.tpl in your template.

In link.php start by looking at print_summary(), but you probably really want to edit fill_smarty() in that file. This is where you need to add the category keywords to the smarty template, so that they are available for the link listing item.

Once you've made a variable available to smarty, then you can add it to your template to actually display it.

I would strongly suggest using more display friendly category names though - much, much easier!
Thanks for your answer. The problem is that I followed a guide at this blog: http://socialcmsbuzz.com/optimize-yo...ions-11122007/ to optimize the urls of the stories. Therefore I have non capital letters in all category names and no spaces between the words in the category names. The guide only works if the names of the categories consist of non capital letters, at least it says. This fact makes it hard to change the names of the categories to the names I wish to display on my site.

I did this to my link.php-file:

First of all I added this line of code $smarty->assign('category_keywords', $this->category_keywords()); below the code:

//assign category id to smarty, so we can use it in the templates. Needed for category colors!
$smarty->assign('category_id', $this->category);

Then I created this function just above the category_safe_name() function:

function category_keywords() {
// $the_cats is set in /libs/smartyvariables.php
global $dblang, $the_cats;
foreach($the_cats as $cat){
if($cat->category_id == $this->category && $cat->category_lang == $dblang)
{
return $cat->category_keywords;
}
}
}

Then I put {$category_keywords} in my link_summary.tpl-file. I have no skill in php. Did I do this right or is something bad or wrong? At least it seems to work on my site.
Does this method do any harm to the SEO of my site. Does Google dislike this use of category keywords?

Last edited by gnalkit; 11-23-2008 at 03:16 PM.
Reply With Quote
  #4 (permalink)  
Old 11-25-2008, 07:22 AM
New Pligger
Pligg Version: 9.9.5
 
Join Date: Oct 2008
Posts: 2
I've had a quick skim of that article and I didn't spot anything that would suggest you should set all your categories to be lower case. I especially don't think you should have category names without spaces for SEO purposes. In fact without spaces the search engine wont know they are separate words!

Probably also worth noting that the article you mention was written for a much older version of Pligg. Pligg 9.9.5 includes at least some of the SEO enhancements discussed already.

If your code works then I'm sure it's fine (it looks reasonable but I haven't tested it), but I would still recommend that you rethink your use of the category name.
Reply With Quote
  #5 (permalink)  
Old 11-26-2008, 06:17 AM
Casual Pligger
 
Join Date: Apr 2008
Posts: 38
Quote:
Originally Posted by spither View Post
I've had a quick skim of that article and I didn't spot anything that would suggest you should set all your categories to be lower case. I especially don't think you should have category names without spaces for SEO purposes. In fact without spaces the search engine wont know they are separate words!

Probably also worth noting that the article you mention was written for a much older version of Pligg. Pligg 9.9.5 includes at least some of the SEO enhancements discussed already.

If your code works then I'm sure it's fine (it looks reasonable but I haven't tested it), but I would still recommend that you rethink your use of the category name.
Well, maybe it was the sitemap XML plugin that needed the lower case category names. I don't really remember, but some kind of modification didn't work without lower case category names and so spaces between words.
Reply With Quote
Reply

Tags
category

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Control of meta description - categories Divisive Cotton Questions and Comments 71 03-29-2011 10:03 PM
Get category ID and show category name footprint Questions and Comments 0 02-25-2009 01:40 AM
Affiliate tip: Use phpBay API to show eBay listings on your pligg site! teachwny Questions and Comments 0 01-29-2009 03:12 PM
Pligg Categories Yankidank Wiki Articles 1 12-17-2008 11:10 AM
Show Top Stories by Category in Sidebar - A How To TrailofDead Questions and Comments 0 04-23-2007 10:30 PM


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