Remove the SilverStripe generator meta tag
Oh dear, SilverStripe 2.3.1+ now has an updated meta tag function that has a “generator” meta tag which includes detailed version numbers of the CMS. Eg for version 2.3.1, it has the text: “SilverStripe 2.3.1 – http://www.silverstripe.com”. Take a look here as to why I think this is a bad idea.
This is a real pity, and not something I want to have in a production website. SilverStripe is a great CMS and development framework and deserves praise (as does the web development company behind it, SilverStripe), but not right down to the release number!
Removing the generator tag is pretty straightforward:
- Open the Page.ss for your theme. Eg for blackcandy, open /themes/blackcandy/templates/Page.ss
- Remove this function call: $MetaTags(false) (could be $MetaTags(true) either)
- This prevents the generator tag from being output, but it stops a few other meta tags too, so I suggest you add the following to your Page.ss in the <head> section:
<title><% if MetaTitle %>$MetaTitle <% else %>$Title <% end_if %>- MyWebSiteName</title>
<% if MetaKeywords %><meta name="keywords" http-equiv="keywords" content="$MetaKeywords" /><% end_if %>
<% if MetaDescription %><meta name="description" http-equiv="description" content="$MetaDescription" /><% end_if %>
<meta name="generator" http-equiv="generator" content="SilverStripe - http://www.silverstripe.com" /> - Save your file and upload if necessary. Once you flush the cache, your should see the changes
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="en"/>
Now you might notice that I did slightly more than just meta tags there: I also updated the <title> tag. The $MetaTags function call I removed can output a title tag if $MetaTags(true) rather than false is set and you have a meta title set for your page in addition to the standard title.
This is a good idea for some pages. For example, a page on a site I was recently working on was called “Home”. This was fine for the navigation label and actual on page title, but “Home – MyWebsiteName” does not look good for a window title or in google search results, so we used the meta title to set something which only appears in the meta data and not on the actual page, which was more descriptive and useful.
You might also notice I did not completely remove the generator tag. Well I do want to show my support for SilverStripe so in this particular instance I have just removed any mention of version numbers. At least you now have control over this text.
Some caveats though: my code above replaces what the MetaTags function currently does, but this may change in future so that were additional functionality added to the function, you might be missing out. It also gathers data such as the language and content-type automatically which you need to set manually in my code (if you need to change it).
I will blog again on the MetaTags function if it does change. A perfect reason for subscribing to my RSS feed!

Hey Ronan, didn’t know you had a blog
You’re right, this provides more information than necessary, the generator tag will not show the version number in our next release.
BTW, you could’ve customized this a bit easier by overriding the SiteTree->MetaTags() method in your Page.php
If you are paranoid about displaying the version number publicly – and some good points in your previous blog entry – you might also wish to delete the silverstripe_version files from your modules before you push it live
For example – http://www.cashtrack.co.nz/cms/silverstripe_version
Thanks Will, I totally missed that file!
Looks like they removed the version number in r73836 of SiteTree.php
Iraqi city hit by triple bombing