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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Extend Meta Tab

Go to End

8 Posts   2593 Views


Community Member, 7 Posts

17 January 2009 at 2:11am

How can I extend the meta tag tab to include additional information. We have about 50 additional meta tags (Dublin Core / eGMS) that we need to include.


Community Member, 119 Posts

17 January 2009 at 2:53am

Sorry pinkdigital I cant help you with your problem (new to SS myself).

I was wondering what goverment site you are developing/re-developing and how SS is working out for you?


Community Member, 25 Posts

17 January 2009 at 3:28am

You can find some info here:

Here is an (untested) example. Create a page: tutorial/code/YourPage.php

 * Defines the YourPage page type
class YourPage extends Page {

static $db = array(
   'Meta1' => 'Text',
   'Meta2' => 'Text'

   static $has_one = array(
class YourPage_Controller extends Page_Controller {
function getCMSFields() {
   $fields = parent::getCMSFields();
   $fields->addFieldToTab('Root.Content.Metadata', new TextField('Meta1'));
   $fields->addFieldToTab('Root.Content.Metadata', new TextField('Meta2'));
   return $fields;


Carbon Crayon

Community Member, 598 Posts

17 January 2009 at 3:40am

Edited: 17/01/2009 4:12am

Hi PinkDigital
I think your best option would be to add a ComplexTableField to add metadata objects to your page (like those in tutorial 4).

So first you need to define your meta data object like this:

Then in your Page.php you would have something like this:

then finally in the <head> of your Page template you would do something like this:

<% control MetaTags %>
<meta name="$Name" <% if http_equiv %> http-equiv="$http_equiv" <% end_if %> content="$Content" >
<% end_control %>


Community Member, 7 Posts

17 January 2009 at 11:10am

Thanks guys very helpful...

Taffy, the only sticking point we have found was the DC / eGMS requirements - everything else SS handles with ease. This will be our 5th SS site (others are basic CMS sites) and we love it.


Community Member, 224 Posts

31 October 2009 at 6:19pm

Edited: 31/10/2009 6:33pm

Hi aram,
Can you expand on your comments please? I did what you mentioned, but get errors. 2.3.3

What I really want to do is get a custom field just before my closing </body> tag so that I can insert specific to the page, a script from google website optimizer. Currently I have the editor to except scripts and forms, but for some reason the footer/body script they have - some of it gets stripped out. The Custom Meta Tag works great for inserting code into the head of each page.

I was able to add a field to the Metadata tab at the bottom where I wanted it using this code...

public static $db = array(
'CustomBodyTags' => 'HTMLText'

$fields->addFieldToTab('Root.Content.Metadata', new TextField('CustomBodyTags'));

Added $CustomBodyTags to the bottom of my template.

Also, I would like the Custom Body Tags field on the meta tab to have 5 rows just like the others.

Any ideas on how to pull this off?

This is the google script... First script stays, second script gets stripped from the editor - the <script> tags stay.
Again, I would prefer that I can just enter the code into the meta field.

<!-- Google Website Optimizer Conversion Script -->
<script type="text/javascript">
if(typeof(_gat)!='object')document.write('<sc'+'ript src="http'+
<script type="text/javascript">
try {
var gwoTracker=_gat._getTracker("UA-11120272-2");
<!-- End of Google Website Optimizer Conversion Script -->


Community Member, 224 Posts

31 October 2009 at 6:31pm

Now it is working. The script shows up fine in the source code!

So my next questions would be if this is the right way to do this???

And, how can I make the field have 5 rows - memofield?


Community Member, 224 Posts

31 October 2009 at 7:52pm

I got this figured out now too...

$fields->addFieldToTab("Root.Content.Metadata", new TextareaField("CustomBodyTags", "Custom Body Tags"));

Added the TextareaField and the , "Custom Body Tags" to get my spaces.