Freetag Title Tags

Creating and modifying plugins.
Post Reply
kharri1073
Regular
Posts: 15
Joined: Tue May 09, 2006 6:01 pm
Contact:

Freetag Title Tags

Post 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.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Freetag Title Tags

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
kharri1073
Regular
Posts: 15
Joined: Tue May 09, 2006 6:01 pm
Contact:

Post 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.
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post 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}
Judebert
---
Website | Wishlist | PayPal
kharri1073
Regular
Posts: 15
Joined: Tue May 09, 2006 6:01 pm
Contact:

Post by kharri1073 »

That's it. Thank you.
kharri1073
Regular
Posts: 15
Joined: Tue May 09, 2006 6:01 pm
Contact:

Post 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?
kharri1073
Regular
Posts: 15
Joined: Tue May 09, 2006 6:01 pm
Contact:

Post by kharri1073 »

Can I get the category in the title with this change or is this not possible?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
kharri1073
Regular
Posts: 15
Joined: Tue May 09, 2006 6:01 pm
Contact:

Post 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.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply