More on Easy Expression Engine Titles
I like to have repeating elements in a common template and embed this template in place of the code. But I also wanted to be able to show different titles for different sections (blog home page, entry page, category archive page, etc.). How to do it?
Default title
The first thing to do is set the default title if the title variable passed by the calling (parent) template is empty and show the actual title otherwise:
{if title == ""}
<title>SimplyGold | Templates, Themes, Tutorials
</title>
{if:else}
<title>{embed:title} | SimplyGold</title>
{/if}
Post titles
To show the title of the posts on the entry page:
{embed="common/header" title="{exp:weblog:entries
weblog="{master_weblog_name}"
limit="1"
disable="
categories|
custom_fields|
member_data|
pagination|
trackbacks"}
{title}{/exp:weblog:entries}"}
The category archives page
{embed="common/header" title="
{exp:weblog:category_heading
weblog="{master_weblog_name}"}
{category_description}
{/exp:weblog:category_heading}"}
This works even if you use the index template to show your category archives (that is, it shows the default title when you're not browsing the archives). The reason for this is that if we're not browsing the archives, the {category_description} returns an empty string, in which case we show the default title, remember.
1.
Rasel on January 27, 2007 at 08:19 pm
Man you don't even know how long I've waited for this since disabling my own Movable Type widget (that doesn't work since Haloscan bypasses that code).