How do I customize <title> of SilverStripe pages -
how customize <title>
of silverstripe pages?
right it's
<title><% if $metatitle %>$metatitle<% else %>$title<% end_if %> » $siteconfig.title</title>
your current page template page <title>
tag is:
<title> <% if $metatitle %>$metatitle<% else %>$title<% end_if %> » $siteconfig.title </title>
you can change use variable or content like.
your current template code checks if page has $metatitle
defined. if use this. otherwise use page $title
.
the last part adds site title $siteconfig.title
end. field can found in cms on settings tab.
the metatitle
variable removed core silverstripe code in 3.1. if add functionality in can installing silverstripe metatitle module or adding variable , input page class yourself.
here code add metatitle
variable page
class:
class page extends sitetree { private static $db = array( 'metatitle' => 'varchar(255)' ); public function getcmsfields() { $fields = parent::getcmsfields(); $fields->addfieldtotab( 'root.main', textfield::create('metatitle') ->setrighttitle('shown @ top of browser window , used "linked text" search engines.') ->addextraclass('help'), 'metadescription' ); return $fields; } }
the variable appear in cms on each page underneath content
field.
Comments
Post a Comment