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 %> &raquo; $siteconfig.title</title> 

your current page template page <title> tag is:

<title>     <% if $metatitle %>$metatitle<% else %>$title<% end_if %>      &raquo; $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

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -