Frontend\Core\Engine\Footer::getSiteLinksCode PHP Метод

getSiteLinksCode() защищенный Метод

More information can be found on the offical Google documentation: https://developers.google.com/webmasters/richsnippets/sitelinkssearch
protected getSiteLinksCode ( string $searchUrl ) : string
$searchUrl string The url to the search page
Результат string The script needed for google
    protected function getSiteLinksCode($searchUrl)
    {
        $siteLinksCode = '<script type="application/ld+json">' . "\n";
        $siteLinksCode .= '{' . "\n";
        $siteLinksCode .= '    "@context": "http://schema.org",' . "\n";
        $siteLinksCode .= '    "@type": "WebSite",' . "\n";
        $siteLinksCode .= '    "url": "' . SITE_URL . '",' . "\n";
        $siteLinksCode .= '    "potentialAction": {' . "\n";
        $siteLinksCode .= '        "@type": "SearchAction",' . "\n";
        $siteLinksCode .= '        "target": "' . SITE_URL . $searchUrl . '?form=search&q_widget={q_widget}",' . "\n";
        $siteLinksCode .= '        "query-input": "name=q_widget"' . "\n";
        $siteLinksCode .= '    }' . "\n";
        $siteLinksCode .= '}' . "\n";
        $siteLinksCode .= '</script>';
        return $siteLinksCode;
    }