Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Nesting search engine meta-tag titles?

Go to End

3 Posts   1575 Views


Community Member, 8 Posts

15 August 2010 at 3:39pm

Hi folks,

I was wondering if SilverStripe has the functionality of automatically nesting search engine meta-tag titles. For instance, the name of my website is "The Lusitania Resource," so I'd like my subsequent pages to automatically have "The Lusitania Resource" appended to the search engine titles (e.g. "Mixed Claims Commission « The Lusitania Resource").

Or does this functionality not exist and I would have to do all of this by hand?


Community Member, 254 Posts

17 August 2010 at 11:10am

There is a function on SiteTree.php line 1225 called MetaTags()
You should be able to overwrite this in mysite/code/Page.php to control the meta tag behavior.

But I think you just want to edit the page Titles yeah?

<title><% if MetaTitle %>$MetaTitle<% else %>$Title<% end_if %> &raquo; $SiteConfig.Title</title>

If you just wanted The Lusitania Resource appended to every title you could make it you site Title or hard code it in

<title><% if MetaTitle %>$MetaTitle<% else %>$Title<% end_if %> &raquo; The Lusitania Resource</title>

Or if you wanted something more dynamic you could control the parent in the title output kind of like bread crumbs.

<title><% if MetaTitle %>$MetaTitle<% else %>$Title<% end_if %> &raquo; <% control Parent %><% if MetaTitle %>$MetaTitle<% else %>$Title<% end_if %><% end_control %></title>

That should pull the parents title or meta tag.


Community Member, 8 Posts

17 August 2010 at 11:27pm

Hey that's pretty neat with the breadcrumb-like layout. It looks great with the nested pages, looking like:

XXXXXX » YYYYYY » The Lusitania Resource

But now I've run into a problem with the top-level pages where they look like

YYYYYY » » The Lusitania Resource

Where the » is appearing twice. Is there a way around this so that » appears only for the number of times needed?