Schema.org structured data in JSON-LD format enables search engines (like Google) to understand your content deeply, unlocking rich results such as Article cards, Star ratings, Breadcrumb trails, and Product pricing snippets.
SeoKit provides built-in schema generators for common entity types and full support for custom Schema.org objects.
Access the JSON-LD manager via SeoKit::jsonld():
use Larament\SeoKit\Facades\SeoKit;
SeoKit::jsonld()->website([
'potentialAction' => [
'@type' => 'SearchAction',
'target' => 'https://example.com/search?q={search_term_string}',
'query-input' => 'required name=search_term_string',
],
]);SeoKit::jsonld()->organization([
'logo' => 'https://example.com/logo.png',
'sameAs' => [
'https://twitter.com/myorg',
'https://github.com/myorg',
'https://linkedin.com/company/myorg',
],
]);SeoKit::jsonld()->article([
'headline' => $post->title,
'description' => $post->excerpt,
'image' => $post->featured_image_url,
'author' => [
'@type' => 'Person',
'name' => $post->author->name,
'url' => route('authors.show', $post->author),
],
'datePublished' => $post->published_at->toISOString(),
'dateModified' => $post->updated_at->toISOString(),
]);For blog posts specifically, you can also use SeoKit::jsonld()->blogPosting([...]).
Ideal for e-commerce stores:
SeoKit::jsonld()->product([
'name' => 'Ergonomic Mechanical Keyboard',
'image' => 'https://example.com/images/keyboard.jpg',
'description' => 'Compact mechanical keyboard with hot-swappable switches.',
'sku' => 'KB-900',
'offers' => [
'@type' => 'Offer',
'price' => '149.00',
'priceCurrency' => 'USD',
'availability' => 'https://schema.org/InStock',
'url' => route('products.show', 'keyboard'),
],
]);SeoKit::jsonld()->localBusiness([
'name' => 'Acme Coffee Roasters',
'image' => 'https://example.com/store.jpg',
'address' => [
'@type' => 'PostalAddress',
'streetAddress' => '123 Main St',
'addressLocality' => 'Austin',
'addressRegion' => 'TX',
'postalCode' => '78701',
],
'telephone' => '+1-555-0199',
'openingHours' => 'Mo-Fr 07:00-19:00',
]);You can pass any arbitrary Schema.org array to add():
SeoKit::jsonld()->add([
'@context' => 'https://schema.org',
'@type' => 'BreadcrumbList',
'itemListElement' => [
[
'@type' => 'ListItem',
'position' => 1,
'name' => 'Home',
'item' => url('/'),
],
[
'@type' => 'ListItem',
'position' => 2,
'name' => 'Blog',
'item' => url('/blog'),
],
[
'@type' => 'ListItem',
'position' => 3,
'name' => $post->title,
'item' => url()->current(),
],
],
]);SeoKit::jsonld()->add([
'@context' => 'https://schema.org',
'@type' => 'FAQPage',
'mainEntity' => [
[
'@type' => 'Question',
'name' => 'Is SeoKit compatible with Laravel Octane?',
'acceptedAnswer' => [
'@type' => 'Answer',
'text' => 'Yes! SeoKit uses request-scoped bindings to prevent state pollution in Octane.',
],
],
],
]);When rendered, SeoKit converts schemas into secure, escaped <script type="application/ld+json"> tags:
<script type="application/ld+json">{"@context":"https://schema.org","@type":"Article","headline":"Laravel Performance Tips"}</script>You can clear all registered schemas using SeoKit::jsonld()->clear().