[SOLVED] add category on news title

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
giapippo
Forum Members
Forum Members
Posts: 176
Joined: Tue Feb 28, 2012 1:24 pm

[SOLVED] add category on news title

Post 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
Last edited by giapippo on Fri Feb 27, 2015 5:41 pm, edited 1 time in total.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: add category on news title

Post 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.
giapippo
Forum Members
Forum Members
Posts: 176
Joined: Tue Feb 28, 2012 1:24 pm

Re: add category on news title

Post by giapippo »

thank you
the solution was simple and I am confused unnecessarily

thanks
Post Reply

Return to “Modules/Add-Ons”