In order to display the current entry title in the title bar, I use something like this:
{exp:weblog:entries weblog="articles" limit="1"}
{embed="includes/head" my_title="{title}"}
...Where “head” is a template that contains all the <head> code, and uses the embedded variable as the page’s title. I don’t know if this is the “correct” way to do this, or if EE has a dedicated function, but up to now it works fine.
But now I’m looking to add the current category to the title, when applicable.
I tried using the following code:
{exp:weblog:entries weblog="articles" limit="1"}
{categories limit="1"}
{embed="includes/head" my_title="{category_name}: {title}"}
{/categories}
...But this doesn’t work when the entry has no category asigned to it.
Is there a conditional to check if an entry belongs to one or more categories ? Or another way to fix this ?