Topic Title: Dynamic Titles SEO just add one line!

Forum Index » Gallery 2 Integration » Dynamic Titles SEO just add one line!
Topic URL: http://www.nukedgallery.net/postt4075.html

AuthorMessage
Post Title: Dynamic Titles SEO just add one line!
THoTH
Joined: May 15, 2008
Posts: 13

Posted: Thu Jul 31, 2008 5:54 am
What an episode, I've been looking for how to change the title bar in the browser for better SEO with Nukedgallery. I have worked out how to do it, but the credit should rest with dmolavi for the header extraction code, but he forgot to do anything with the $pagetitle variable ! Wink

Open your index.php and find this


Code: ›
               foreach($javascript as $script) {
                    $scriptline = $script;
                    $scriptline = str_replace('"','\"',$scriptline);
                    $header .= 'echo "' . $scriptline. '\n";'."\n";
                }


Then add afterwards this line

Code: › $header .='echo "<title>$pagetitle - $sitename Gallery</title>";';


Done !

AuthorMessage
Post Title: Re: Dynamic Titles SEO just add one line!
THoTH
Joined: May 15, 2008
Posts: 13

Posted: Thu Jul 31, 2008 6:08 am
Just as a follow up to that last post, if you want the full breadcrumb trail in the title bar, create a folder in your themes templates directory called local, then copy theme.tpl into it. Then modify that theme.tpl for your chosen theme. Find the section with the <title> definition, usually looks like this..

Code: ›     {* If Gallery doesn't provide a header, we use the album/photo title (or filename) *}
      <title>{$theme.item.title|default:$theme.item.pathComponent|markup:strip}</title>


And replace it with this


Code: › <title>{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>


Now you have a full path in your title bar Cool

AuthorMessage
Post Title: Re: Dynamic Titles SEO just add one line!
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Thu Jul 31, 2008 6:29 am
actually, don't modify theme.tpl. make a folder in your theme's directory called local, ie: matrix/local/ and then copy theme.tpl into there and modify that copy. this way, even if you update your g2 installation, your modification won't be lost, since g2 will always use files in the local directory first...

AuthorMessage
Post Title: Re: Dynamic Titles SEO just add one line!
THoTH
Joined: May 15, 2008
Posts: 13

Posted: Thu Jul 31, 2008 8:48 am
Info amended, that'll teach me to post just before I go out. Laughing

AuthorMessage
Post Title: Re: Dynamic Titles SEO just add one line!
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Thu Jul 31, 2008 2:19 pm
it's all good, thanks for the tip. i'm going to sticky this post Smile

AuthorMessage
Post Title: Re: Dynamic Titles SEO just add one line!
Stratego
Joined: Jul 22, 2007
Posts: 1

Posted: Sun Oct 12, 2008 1:25 am
Is it possible to do the exact same thing (title breadcrumb) but omit the root album on every album except the root one ?

My root album's name is Home, but I don't want to have "Home - Album1 - Sub-Album1" on every page, I just want "Sitename - Album1 - Sub-Album1"

Thanks.

AuthorMessage
Post Title: Re: Dynamic Titles SEO just add one line!
chumstar
Joined: Sep 04, 2009
Posts: 3
Location: Australia, Sdyney
Posted: Mon Feb 08, 2010 8:40 am
nice and simple, will try it out

AuthorMessage
Post Title: Re: Dynamic Titles SEO just add one line!
Suella
Joined: Dec 18, 2010
Posts: 2
Location: Los Angeles
Posted: Fri Jan 14, 2011 4:02 pm
I tried it out already and it worked. Thanks.

AuthorMessage
Post Title: Re: Dynamic Titles SEO just add one line!
DestinJoe21
Joined: May 05, 2011
Posts: 2

Posted: Thu May 05, 2011 1:22 pm
destin beach front rentals [fivestargulfrentals.com]
destin gulf front rentals [fivestargulfrentals.com]

AuthorMessage
Post Title: Re: Dynamic Titles SEO just add one line!
DestinJoe21
Joined: May 05, 2011
Posts: 2

Posted: Thu May 05, 2011 1:23 pm
destin beach front rentals [fivestargulfrentals.com]
destin gulf front rentals [fivestargulfrentals.com]

All times are GMT - 5 Hours
Powered by PHPNuke and phpBB2 © 2006 phpBB Group