public function MetaTags($includeTitle = true)
    {
        $tags = array();

        if ($includeTitle && strtolower($includeTitle) != 'false') {
            $title = $this->owner->MetaTitle
                ? $this->owner->MetaTitle
                : $this->owner->Title;
            $tags[] = HTML::createTag('title', array(), $title);
        }
        $generator = trim(Config::inst()->get(SiteTree::class, 'meta_generator'));
        if (!empty($generator)) {
            $tags[] = HTML::createTag('meta', array(
                'name' => 'generator',
                'content' => $generator,
            ));
        }

        $charset = ContentNegotiator::config()->uninherited('encoding');
        $tags[] = HTML::createTag('meta', array(
            'http-equiv' => 'Content-Type',
            'content' => 'text/html; charset=' . $charset,
        ));

        if ($this->owner->MetaDescription) {
            $tags[] = HTML::createTag('meta', array(
                'name' => 'description',
                'content' => $this->owner->MetaDescription,
            ));
        }

        $this->owner->extend('updateMetaTagsArray', $tags);
        $tagString = implode("\n", $tags);
        $this->owner->extend('updateMetaTags', $tagString);

        return DBField::create_field('HTMLFragment', $tagString);
    }
public function MetaTags($includeTitle = true)
    {
        $tags = array();

        if ($includeTitle && strtolower($includeTitle) != 'false') {
            $title = $this->owner->MetaTitle
                ? $this->owner->MetaTitle
                : $this->owner->Title;
            $tags[] = HTML::createTag('title', array(), $title);
        }
        $generator = trim(Config::inst()->get(SiteTree::class, 'meta_generator'));
        if (!empty($generator)) {
            $tags[] = HTML::createTag('meta', array(
                'name' => 'generator',
                'content' => $generator,
            ));
        }

        $charset = ContentNegotiator::config()->uninherited('encoding');
        $tags[] = HTML::createTag('meta', array(
            'http-equiv' => 'Content-Type',
            'content' => 'text/html; charset=' . $charset,
        ));

        if ($this->owner->MetaDescription) {
            $tags[] = HTML::createTag('meta', array(
                'name' => 'description',
                'content' => $this->owner->MetaDescription,
            ));
        }

        $this->owner->extend('updateMetaTagsArray', $tags);
        $tagString = implode("\n", $tags);
        $this->owner->extend('updateMetaTags', $tagString);

        return DBField::create_field('HTMLFragment', $tagString);
    }
public function MetaTags ( $ includeTitle = true ) { $ tags = array ( ) ; if ( $ includeTitle && strtolower ( $ includeTitle ) != 'false' ) { $ title = $ this -> owner -> MetaTitle ? $ this -> owner -> MetaTitle : $ this -> owner -> Title ; $ tags [ ] = HTML :: createTag ( 'title' , array ( ) , $ title ) ; } $ generator = trim ( Config :: inst ( ) -> get ( SiteTree :: class , 'meta_generator' ) ) ; if ( ! empty ( $ generator ) ) { $ tags [ ] = HTML :: createTag ( 'meta' , array ( 'name' => 'generator' , 'content' => $ generator , ) ) ; } $ charset = ContentNegotiator :: config ( ) -> uninherited ( 'encoding' ) ; $ tags [ ] = HTML :: createTag ( 'meta' , array ( 'http-equiv' => 'Content-Type' , 'content' => 'text/html; charset=' . $ charset , ) ) ; if ( $ this -> owner -> MetaDescription ) { $ tags [ ] = HTML :: createTag ( 'meta' , array ( 'name' => 'description' , 'content' => $ this -> owner -> MetaDescription , ) ) ; } $ this -> owner -> extend ( 'updateMetaTagsArray' , $ tags ) ; $ tagString = implode ( "\n" , $ tags ) ; $ this -> owner -> extend ( 'updateMetaTags' , $ tagString ) ; return DBField :: create_field ( 'HTMLFragment' , $ tagString ) ; }
Generate custom meta tags to display on the DataObject view page.

@param bool $includeTitle

@return DBField
Generate custom meta tags to display on the DataObject view page .