Make photo titles "Album title - Photo title"

nocloo

Joined: 2005-08-18
Posts: 36
Posted: Sun, 2006-02-05 05:16

Where can I change in the template to make the title of a photo when clicked on "Album name - Photo name" instead of "Photo Name" as title ?

Thanks,
nocloo
==

Login or register to post comments
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8598
Posted: Sun, 2006-02-05 17:00

you can turn of buffered debug output in config.php and reload a page to get a popup that shows all the data available to the tpl.... i think you can use {$theme.parent.title|markup} - {$theme.item.title|markup} to show album/photo titles in photo.tpl

Login or register to post comments
nocloo

Joined: 2005-08-18
Posts: 36
Posted: Sun, 2006-02-05 21:25

I found out it's in theme.tpl

I change the line to add pageType
{if empty($head.title)}
{if $theme.pageType == 'photo'}
<title>{$theme.parent.title $theme.item.title|default:$theme.item.pathComponent|markup:strip}</title>
{else}
<title>{$theme.item.title|markup|default:$theme.item.pathComponent|markup:strip}</title>
{/if}
{/if}

But somehow it doesn't append the filename to $theme.parent.title. I did try various combos but didn't get it to work. Any ideas ?

Thanks
==

Login or register to post comments
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8598
Posted: Sun, 2006-02-05 22:06

you need separate { } for each variable you use...
{$theme.parent.title|markup:strip} {$theme.item.title|default:$theme.item.pathComponent|markup:strip}

Login or register to post comments
nocloo

Joined: 2005-08-18
Posts: 36
Posted: Mon, 2006-02-06 23:31

Many thanks ... This is my final fix and it works, my thanks to mindless !! I just want to post for those who wants to improve their ranking in search engines.

theme.tpl

{if empty($head.title)}
{if $theme.pageType == 'photo'}
<title>{$theme.parent.title|markup:strip} - {$theme.item.pathComponent|markup:strip}</title>
{else}
<title>{$theme.item.title|markup|default:$theme.item.pathComponent|markup:strip}</title>
{/if}
{/if}

Login or register to post comments
Illah

Joined: 2006-06-05
Posts: 12
Posted: Thu, 2006-06-08 05:37

Here's my small tweak to this code. My only issue with it was the title defaulted to the pathComponent in nocloo's version. For example, let's say you have a gallery called 'Toyota Cars', and in that gallery you have a picture with a filename 'sweet-car.jpg', and then give that picture a title '1994 Twin Turbo Supra MKIV'. With nocloo's version, the title would be:

Toyota Cars - sweet-car.jpg

With my little tweak, G2 will use the image title first, and default to the filename if the image title doesn't exist. With mine, the title tag would read:

Toyota Cars - 1994 Twin Turbo Supra MKIV

Better for spiders, *and* better for the users and search CTR since that title tag is way more descriptive of the image.

The tweaked code:

{if empty($head.title)}
{if $theme.pageType == 'photo'}
<title>{$theme.parent.title|markup:strip} - {$theme.item.title|default:$theme.item.pathComponent|markup:strip}</title>
{else}
<title>{$theme.item.title|markup|default:$theme.item.pathComponent|markup:strip}</title>
{/if}
{/if}

--Illah

Login or register to post comments
turk

Joined: 2005-09-20
Posts: 2
Posted: Fri, 2007-04-20 10:09

I've found another way to do this. I took the code found in /gallery2/modules/core/templates/blocks/BreadCrumb.tpl and just stripped out the hyperlinks. I wasn't happy with the two examples given above as I wanted the full path shown in the title. I have it setup so it copies the style of the breadcrumb in the pages. Example image here. Below is what I've used in my theme.tpl

<title>Hotelblues.com {if isset($separator)} {$separator} {/if}
  {foreach name=parent from=$theme.parents item=parent}
  {if !$smarty.foreach.parent.last}
     &raquo; {$parent.title|markup:strip|default:$parent.pathComponent}
  {else}
     &raquo; {$parent.title|markup:strip|default:$parent.pathComponent}
  {/if}
  {if isset($separator)} {$separator} {/if}
  {/foreach}
  {if ($theme.pageType == 'admin' || $theme.pageType == 'module')}
  {else}
      &raquo; {$theme.item.title|markup:strip|default:$theme.item.pathComponent}
  {/if}</title>
Login or register to post comments