Created
March 27, 2013 19:46
-
-
Save oddnoc/5257417 to your computer and use it in GitHub Desktop.
A simple extension for SilverStripe 3.1 that restores the meta tag behavior of 3.0. Needs SiteTree::add_extension('MetadataExtension'); in your config.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MetadataExtension extends DataExtension { | |
static $db = array( | |
'MetaTitle' => 'Varchar(255)', | |
'MetaKeywords' => 'Varchar(1024)', | |
); | |
function updateCMSFields(FieldList $fields) { | |
$metadata_field = $fields->fieldByName('Root.Main.Metadata'); | |
$metatitle_field = new TextField('MetaTitle', $this->owner->fieldLabel('MetaTitle')); | |
$metakeywords_field = new TextareaField('MetaKeywords', $this->owner->fieldLabel('MetaKeywords')); | |
$metatitle_field | |
->setRightTitle(_t('SiteTree.METATITLEHELP', | |
'Replaces the page name in the HTML <title> element (requires template support).')) | |
->addExtraClass('help'); | |
$metakeywords_field | |
->setRightTitle(_t('SiteTree.METAKEYWORDSHELP', | |
'A list of keywords (not used by search engines; does not appear in HTML without template support).')) | |
->addExtraClass('help'); | |
$metadata_field->push($metakeywords_field); | |
$metadata_field->push($metatitle_field); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please let us know about this extension is fine https://gist.github.com/blpraveen/8c64f04f97cd43cbad3c