Page 1 of 1

[SOLVED] add category on news title

Posted: Fri Feb 27, 2015 1:57 pm
by giapippo
hallo

for improve seo option i would like to include in the title of the news also Category news

in cms news detail template i have:

{assign var='pagetitle' value=$entry->title}


in template page i have:

<title>{if isset($pagetitle)}{$pagetitle} - {sitename} {/if}</title>

now the page title is some this

TF 12 - TbyF - Tappi per batterie

I would like to get

TF 12 - TAPPI SFOGATOI A FILETTO M12, M18 - TbyF - Tappi per batterie

thanks in advance for the help

Re: add category on news title

Posted: Fri Feb 27, 2015 4:09 pm
by velden
From the sample detail template:

====
news_article Object Reference
====

Members:
--
Members can be displayed by the following syntax: {$entry->membername} or assigned to another smarty variable using {assign var='foo' value=$entry->membername}.

The following members are available in the entry array:
...
category (string) = The name of the category that this article is associated with.
So you can get the category name by using:

Code: Select all

{$entry->category}
So now you only need to figure out how to assign that to a the pagetitle variable. If you need advice on that tell us how exactly the string should be build.

Re: add category on news title

Posted: Fri Feb 27, 2015 5:40 pm
by giapippo
thank you
the solution was simple and I am confused unnecessarily

thanks