| Author |
Message |
THoTH
Beginner


Joined: May 15, 2008 Posts: 13
|
Posted: Thu Jul 31, 2008 5:54 am Post subject: Dynamic Titles SEO just add one line! |
|
|
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 !
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 ! |
|
| Back to top |
|
|
AdBot
|
| Post subject: Dynamic Titles SEO just add one line! |
|
|
|
|
|
| Back to top |
|
 |
THoTH
Beginner


Joined: May 15, 2008 Posts: 13
|
Posted: Thu Jul 31, 2008 6:08 am Post subject: Re: Dynamic Titles SEO just add one line! |
|
|
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}
» {$parent.title|markup:strip|default:$parent.pathComponent}
{else}
» {$parent.title|markup:strip|default:$parent.pathComponent}
{/if}
{if isset($separator)} {$separator} {/if}
{/foreach}
{if ($theme.pageType == 'admin' || $theme.pageType == 'module')}
{else}
» {$theme.item.title|markup:strip|default:$theme.item.pathComponent}
{/if}</title>
Now you have a full path in your title bar 
Last edited by THoTH on Thu Jul 31, 2008 8:52 am; edited 1 time in total |
|
| Back to top |
|
|
dari
Site Admin


Joined: Mar 03, 2003 Posts: 6284 Location: Washington Township, NJ, USA
|
Posted: Thu Jul 31, 2008 6:29 am Post subject: Re: Dynamic Titles SEO just add one line! |
|
|
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... _________________
 |
|
| Back to top |
|
|
THoTH
Beginner


Joined: May 15, 2008 Posts: 13
|
Posted: Thu Jul 31, 2008 8:48 am Post subject: Re: Dynamic Titles SEO just add one line! |
|
|
Info amended, that'll teach me to post just before I go out.  |
|
| Back to top |
|
|
dari
Site Admin


Joined: Mar 03, 2003 Posts: 6284 Location: Washington Township, NJ, USA
|
Posted: Thu Jul 31, 2008 2:19 pm Post subject: Re: Dynamic Titles SEO just add one line! |
|
|
it's all good, thanks for the tip. i'm going to sticky this post  _________________
 |
|
| Back to top |
|
|
Stratego
Beginner


Joined: Jul 22, 2007 Posts: 1
|
Posted: Sun Oct 12, 2008 1:25 am Post subject: Re: Dynamic Titles SEO just add one line! |
|
|
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. |
|
| Back to top |
|
|
|
|
|
|
|