src/Sulu/Bundle/WebsiteBundle/Twig/Meta/MetaTwigExtension.php
public function getSeoMetaTags($extension, $content)
    {
        $seo = [];
        if (array_key_exists('seo', $extension)) {
            $seo = $extension['seo'];
        }
        $excerpt = [];
        if (array_key_exists('excerpt', $extension)) {
            $excerpt = $extension['excerpt'];
        }

        // fallback for seo description
        if (
            (!array_key_exists('description', $seo) || '' === $seo['description']) &&
            array_key_exists('description', $excerpt) && '' !== $excerpt['description']
        ) {
            $seo['description'] = strip_tags($excerpt['description']);
        }

        $seo['description'] = substr($seo['description'], 0, 155);

        // generate robots content
        $robots = [];
        $robots[] = (array_key_exists('noIndex', $seo) && true === $seo['noIndex']) ? 'noIndex' : 'index';
        $robots[] = (array_key_exists('noFollow', $seo) && true === $seo['noFollow']) ? 'noFollow' : 'follow';

        // build meta tags
        $result = [];
        $result[] = $this->getMeta('description', $seo['description']);
        $result[] = $this->getMeta('keywords', $seo['keywords']);
        $result[] = $this->getMeta('robots', strtoupper(implode(', ', $robots)));

        return implode(PHP_EOL, $result);
    }
public function getSeoMetaTags($extension, $content)
    {
        $seo = [];
        if (array_key_exists('seo', $extension)) {
            $seo = $extension['seo'];
        }
        $excerpt = [];
        if (array_key_exists('excerpt', $extension)) {
            $excerpt = $extension['excerpt'];
        }

        // fallback for seo description
        if (
            (!array_key_exists('description', $seo) || '' === $seo['description']) &&
            array_key_exists('description', $excerpt) && '' !== $excerpt['description']
        ) {
            $seo['description'] = strip_tags($excerpt['description']);
        }

        $seo['description'] = substr($seo['description'], 0, 155);

        // generate robots content
        $robots = [];
        $robots[] = (array_key_exists('noIndex', $seo) && true === $seo['noIndex']) ? 'noIndex' : 'index';
        $robots[] = (array_key_exists('noFollow', $seo) && true === $seo['noFollow']) ? 'noFollow' : 'follow';

        // build meta tags
        $result = [];
        $result[] = $this->getMeta('description', $seo['description']);
        $result[] = $this->getMeta('keywords', $seo['keywords']);
        $result[] = $this->getMeta('robots', strtoupper(implode(', ', $robots)));

        return implode(PHP_EOL, $result);
    }
public function getSeoMetaTags ( $ extension , $ content ) { $ seo = [ ] ; if ( array_key_exists ( 'seo' , $ extension ) ) { $ seo = $ extension [ 'seo' ] ; } $ excerpt = [ ] ; if ( array_key_exists ( 'excerpt' , $ extension ) ) { $ excerpt = $ extension [ 'excerpt' ] ; } // fallback for seo description if ( ( ! array_key_exists ( 'description' , $ seo ) || '' === $ seo [ 'description' ] ) && array_key_exists ( 'description' , $ excerpt ) && '' !== $ excerpt [ 'description' ] ) { $ seo [ 'description' ] = strip_tags ( $ excerpt [ 'description' ] ) ; } $ seo [ 'description' ] = substr ( $ seo [ 'description' ] , 0 , 155 ) ; // generate robots content $ robots = [ ] ; $ robots [ ] = ( array_key_exists ( 'noIndex' , $ seo ) && true === $ seo [ 'noIndex' ] ) ? 'noIndex' : 'index' ; $ robots [ ] = ( array_key_exists ( 'noFollow' , $ seo ) && true === $ seo [ 'noFollow' ] ) ? 'noFollow' : 'follow' ; // build meta tags $ result = [ ] ; $ result [ ] = $ this -> getMeta ( 'description' , $ seo [ 'description' ] ) ; $ result [ ] = $ this -> getMeta ( 'keywords' , $ seo [ 'keywords' ] ) ; $ result [ ] = $ this -> getMeta ( 'robots' , strtoupper ( implode ( ', ' , $ robots ) ) ) ; return implode ( PHP_EOL , $ result ) ; }
Returns seo meta tags with fallbacks.

@param array $extension
@param array $content

@return string

@deprecated since 1.1 use SeoTwigExtension::renderSeoTags - sulu_seo
Returns seo meta tags with fallbacks .