georgringer / schema-org-generator
Generate json-ld based on schema org
Fund package maintenance!
georgringer
paypal.me/GeorgRinger/10
www.amazon.de/hz/wishlist/ls/8F573K08TSDG
Patreon
Installs: 7 533
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 4
Forks: 3
Open Issues: 0
Type:typo3-cms-extension
Requires
- php: >=7.4
- spatie/schema-org: ^3
- typo3/cms-core: ^10.4 || ^11.5
Replaces
- typo3-ter/schema-org-generator: 0.3.0
This package is auto-updated.
Last update: 2024-11-13 08:29:37 UTC
README
This extensions generates json-ld from models and is currently just a PoC.
Installation
- Do
composer require spatie/schema-org
- Install this extension
Requirements
- TYPO3 10,11,12
- PHP 7.2+
Usage
Basic usage
In your site template you can write:
<schema:jsonLd type="webSite" data="{url:'https://www.tld.com'}" />
This will output
<script type="application/ld+json">
{"@context":"https:\/\/schema.org","@type":"WebSite","url":"https:\/\/www.tld.com"}
</script>
As type you can use any type available at https://github.com/spatie/schema-org/tree/master/src
Map models to json+ld
Currently only tt_address
is supported. Add this snippet to your ListItem.html
:
Currently it will only output the property email
.
<schema:objectToJsonLd object="{address}" />
This will output
<script type="application/ld+json">
{"@context":"https:\/\/schema.org","@graph":[{"@type":"PostalAddress","email":"mailus@email.com"}]}
</script>