Page 1 of 1
Freetag Title Tags
Posted: Tue Nov 18, 2008 6:45 pm
by kharri1073
Hi,
I want to change the html title tag for tagged entries. All of the different tag pages in /plugin/tag/taggedkeyword have the blog name in the title tag. I do not want to have the blog's title on these pages. I simply want "Entries tagged as taggedkeyword"
How can I do this? Thanks.
Re: Freetag Title Tags
Posted: Wed Nov 19, 2008 10:50 am
by garvinhicking
Hi!
You need to edit your index.tpl template file and replace
Code: Select all
<title>{$head_title|@default:$blogTitle} {if $head_subtitle} - {$head_subtitle}{/if}</title>
with
Code: Select all
{if $CONST.PLUGIN_VARS_TAG != ''}
<title>{$head_subtitle}</title>
{else}
<title>{$head_title|@default:$blogTitle} {if $head_subtitle} - {$head_subtitle}{/if}</title>
HTH,
Garvin
Posted: Wed Nov 19, 2008 5:47 pm
by kharri1073
Code: Select all
{if $CONST.PLUGIN_VARS_TAG != ''}
<title>{$head_subtitle}</title>
{else}
<title>{$head_title|@default:$blogTitle} {if $head_subtitle} - {$head_subtitle}{/if}</title>
{/if}
That didn't quite work. The title code correctly displayed "Entries tagged with ... " on pages with tagged keywords however the homepage, entry pages and some archive pages had no title.
Posted: Wed Nov 19, 2008 8:05 pm
by judebert
I see. Try this:
Code: Select all
{if $CONST.PLUGIN_VARS_TAG != ''}
<title>{$head_subtitle|@default:$head_title|@default:$blogTitle}</title>
{else}
<title>{$head_title|@default:$blogTitle} {if $head_subtitle} - {$head_subtitle}{/if}</title>
{/if}
Posted: Wed Nov 19, 2008 9:07 pm
by kharri1073
That's it. Thank you.
Posted: Tue Nov 25, 2008 6:00 pm
by kharri1073
Seems like I noticed a problem with this code after using it for a while.
When viewing categories the page title only uses the default blog title. There is no mention of the category in the title tag. How can I get the category's title in the title tag?
Posted: Mon Dec 01, 2008 6:25 pm
by kharri1073
Can I get the category in the title with this change or is this not possible?
Posted: Mon Dec 01, 2008 7:13 pm
by garvinhicking
Hi!
When you view "Tags", you don't have a category. So in this case, the ELSE-Condition of the if statement in your template file should already take care of it.
What's your URL so that we can see iT? And how does your index.tpl file look like right now in the head section?
Regards,
Garvin
Posted: Tue Dec 02, 2008 5:34 pm
by kharri1073
http://www.ammoland.com/
An example of my concern is any of the categories in the left hand side.
http://www.ammoland.com/categories/7-Accessories
Code: Select all
{if $CONST.PLUGIN_VARS_TAG != ''}
<title>{$head_subtitle|@default:$head_title|@default:$blogTitle}{if $footer_currentPage != 1 && $entry_id != true} | Page {$footer_currentPage}{/if}</title>
{else}
<title>{$head_title|@default:$blogTitle}{if $head_subtitle} - {$head_subtitle}{/if}{if $footer_currentPage != 1 && $entry_id != true && $staticpage_content == ''} - Page {$footer_currentPage}{/if}</title>
{/if}
I added a little bit to the end for pagenation at the end of the title. I tried the code supplied above without my code for the pagenation and i still was unable to see the title of the category in the title tag.
Posted: Tue Dec 02, 2008 6:51 pm
by garvinhicking
Hi!
Hm, usually in category view the name of the category should be a part of. For category view, inside index.php this code exists:
Code: Select all
$serendipity['head_title'] = $cInfo['category_name'];
$serendipity['head_subtitle'] = $serendipity['blogTitle'];
which puts the category name into what will later be $head_title.
You can try to access {$category_info.category_name} directly and put it iside the title tag though?
Regards,
Garvin