hashandsalt / kirby3-schema
Kirby 3 - Schema
Installs: 1 582
Dependents: 1
Suggesters: 0
Security: 0
Stars: 18
Watchers: 2
Forks: 0
Open Issues: 1
Type:kirby-plugin
Requires
- getkirby/composer-installer: ^1.2
- spatie/schema-org: ^3.8
This package is auto-updated.
Last update: 2024-11-20 20:37:08 UTC
README
This plugin is for easily generating JSON Schema structured data.
Install
Download
Download and copy this repository to /site/plugins/kirby3-schema
.
Composer
composer require hashandsalt/kirby3-schema
Commercial Usage
This plugin is free but if you use it in a commercial project please consider to
Usage
It's a wrapper around spatie/schema-org that turns it into a site method, used like this:
<?= $site->schema('LocalBusiness')
->name('Hash&Salt')
->email('email@example.com')
->contactPoint($page->schema('contactPoint')
->areaServed('Worldwide')
) ?>
You can use the if() method to prevent missing data from breaking the chain.
<?= $site->schema('LocalBusiness')
->name('Hash&Salt')
->if($page->email()->exists(), function ($site) {
$site->schema('email')->email('email@example.com');
})
->contactPoint($page->schema('contactPoint')
->areaServed('Worldwide')
) ?>
It supports anything thats in the RDFa spec for structured data which is about 600 data points. Refer to schema.org site for details on each bit. Go nuts :)