Skip to main content
Version: Fegg 5.x

JsonLd::website

The site itself

Description​

public static array JsonLd::website( string $name [, string $url = '/' ] )

Returns a WebSite item: the name search engines show for the site. Set it on the top page. $url becomes an absolute URL.

Arguments​

NameData typeDefaultRemarks
$namestringName of the site
$urlstring'/'Path or URL of the top page

Example​

Controller
use Fegg\Tool\JsonLd;

JsonLd::website('Example Inc.');
Output
{
"@context": "https://schema.org",
"@type": "WebSite",
"name": "Example Inc.",
"url": "https://www.example.com/"
}