src/View/Helper/MetaHelper.php
public function ldJson()
    {
        $attributes = [
            '@context' => 'http://schema.org',
            '@type' => 'WebSite',
            'url' => $this->Url->build('/', true),
            'potentialAction' => [
                '@type' => 'SearchAction',
                'query-input' => 'required name=search_term_string',
                'target' => $this->Url->build([
                    'plugin' => 'Wasabi/Cms',
                    'controller' => 'Frontend/Search',
                    'action' => 'search',
                    'language_id' => Wasabi::contentLanguage()->id
                ], true) . '?q={search_term_string}'
            ]
        ];

        if (!empty(WasabiCms::$instanceName)) {
            $attributes['name'] = WasabiCms::$instanceName;
        }

        $sameAsKeys = [
            'Settings.Cms.SEO.Social.facebook_url',
            'Settings.Cms.SEO.Social.instagram_url',
            'Settings.Cms.SEO.Social.linkedin_url',
            'Settings.Cms.SEO.Social.myspace_url',
            'Settings.Cms.SEO.Social.pinterest_url',
            'Settings.Cms.SEO.Social.youtube_url',
            'Settings.Cms.SEO.Social.googleplus_url'
        ];
        $sameAs = [];

        foreach ($sameAsKeys as $key) {
            $setting = Configure::read($key);
            if (!empty($setting)) {
                $sameAs[] = $setting;
            }
        }

        $twitterName = Configure::read('Settings.Cms.SEO.Social.twitter_username');
        if (!empty($twitterName)) {
            $sameAs[] = 'https://twitter.com/' . $twitterName;
        }

        if (!empty($sameAs)) {
            $attributes['sameAs'] = $sameAs;
        }

        return '<script type="application/ld+json">' . json_encode($attributes) . '</script>';
    }
public function ldJson()
    {
        $attributes = [
            '@context' => 'http://schema.org',
            '@type' => 'WebSite',
            'url' => $this->Url->build('/', true),
            'potentialAction' => [
                '@type' => 'SearchAction',
                'query-input' => 'required name=search_term_string',
                'target' => $this->Url->build([
                    'plugin' => 'Wasabi/Cms',
                    'controller' => 'Frontend/Search',
                    'action' => 'search',
                    'language_id' => Wasabi::contentLanguage()->id
                ], true) . '?q={search_term_string}'
            ]
        ];

        if (!empty(WasabiCms::$instanceName)) {
            $attributes['name'] = WasabiCms::$instanceName;
        }

        $sameAsKeys = [
            'Settings.Cms.SEO.Social.facebook_url',
            'Settings.Cms.SEO.Social.instagram_url',
            'Settings.Cms.SEO.Social.linkedin_url',
            'Settings.Cms.SEO.Social.myspace_url',
            'Settings.Cms.SEO.Social.pinterest_url',
            'Settings.Cms.SEO.Social.youtube_url',
            'Settings.Cms.SEO.Social.googleplus_url'
        ];
        $sameAs = [];

        foreach ($sameAsKeys as $key) {
            $setting = Configure::read($key);
            if (!empty($setting)) {
                $sameAs[] = $setting;
            }
        }

        $twitterName = Configure::read('Settings.Cms.SEO.Social.twitter_username');
        if (!empty($twitterName)) {
            $sameAs[] = 'https://twitter.com/' . $twitterName;
        }

        if (!empty($sameAs)) {
            $attributes['sameAs'] = $sameAs;
        }

        return '<script type="application/ld+json">' . json_encode($attributes) . '</script>';
    }
public function ldJson ( ) { $ attributes = [ '@context' => 'http://schema.org' , '@type' => 'WebSite' , 'url' => $ this -> Url -> build ( '/' , true ) , 'potentialAction' => [ '@type' => 'SearchAction' , 'query-input' => 'required name=search_term_string' , 'target' => $ this -> Url -> build ( [ 'plugin' => 'Wasabi/Cms' , 'controller' => 'Frontend/Search' , 'action' => 'search' , 'language_id' => Wasabi :: contentLanguage ( ) -> id ] , true ) . '?q={search_term_string}' ] ] ; if ( ! empty ( WasabiCms :: $ instanceName ) ) { $ attributes [ 'name' ] = WasabiCms :: $ instanceName ; } $ sameAsKeys = [ 'Settings.Cms.SEO.Social.facebook_url' , 'Settings.Cms.SEO.Social.instagram_url' , 'Settings.Cms.SEO.Social.linkedin_url' , 'Settings.Cms.SEO.Social.myspace_url' , 'Settings.Cms.SEO.Social.pinterest_url' , 'Settings.Cms.SEO.Social.youtube_url' , 'Settings.Cms.SEO.Social.googleplus_url' ] ; $ sameAs = [ ] ; foreach ( $ sameAsKeys as $ key ) { $ setting = Configure :: read ( $ key ) ; if ( ! empty ( $ setting ) ) { $ sameAs [ ] = $ setting ; } } $ twitterName = Configure :: read ( 'Settings.Cms.SEO.Social.twitter_username' ) ; if ( ! empty ( $ twitterName ) ) { $ sameAs [ ] = 'https://twitter.com/' . $ twitterName ; } if ( ! empty ( $ sameAs ) ) { $ attributes [ 'sameAs' ] = $ sameAs ; } return '<script type="application/ld+json">' . json_encode ( $ attributes ) . '</script>' ; }
Render the ld+json script tag to set the schema.org context for a page.

@return string
Render the ld + json script tag to set the schema . org context for a page .