Keyword

Metadata information for categories

More
13 years 5 months ago #68287 by Josh
Replied by Josh on topic Metadata information for categories
I have multiple templates and multiple category.php files so to get around this I guess I could manually add the code into each sub tempate category.php file. I have multiple menu links to category lists for all my major sections and my whole site is powered with k2 so I have to address this some way. Would prefer not to add it into the html of the template. It would be great to be a able to do this via the backend however.

How would one go about adding <meta name="description" content="description text" /> into the category.php file to override the global description which appears currently? Where exactly should I place it in category.php?

Please Log in or Create an account to join the conversation.

More
13 years 5 months ago #68288 by badrun badranaya
Replied by badrun badranaya on topic Metadata information for categories
I apologize for a long time not visiting this forum.I have been experimenting to add meta description in the metadata, which automatically takes the description of a category that is being opened.

 

Here is what I did,

Open the file : components/com_k2/templates/default/category.php

 

just below the code :

defined('_JEXEC') or die('Restricted access');

 

I added some lines like this :

$document =& JFactory::getDocument();$judul = $this->category->description;$judul = str_replace ("<p>", "", $judul);$judul = str_replace ("</p>", "", $judul);$document->setDescription("Direktori Bisnis Lampung | kategori :  $judul ");

 

You can see the result  here (just for example) :

direktori.lampung.cc/pendidikan/perguruan-tinggi.html

 

Look at the metadata description taken from the category descriptions.

Then make your own.

 

Note : I used Joomla! 1.5 and K2 v 2.3

Please Log in or Create an account to join the conversation.

More
13 years 5 months ago #68289 by Josh
Replied by Josh on topic Metadata information for categories
Hi Badrun

Thanks very much for the tip. Works like a dream however I cant believe that this its not possible to put custom meta descriptions in for category list menu items.

 

Thanks again

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago - 11 years 8 months ago #68290 by Mus
Replied by Mus on topic Re: Metadata information for categories
Hi
@badrun badranaya : I'm afraid to say that your tip didn't work for me. I did what you said and my categories on site were messed up. I removed the code and everything is back to normal.
We're still waiting for a magic tip to remedy this defect in K2. It's pity such a wonderful joomla solution comes short in terms of Seo :(

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum