Advanced SEO for structured data
Kirby JSON-LD is a advanced SEO plugin for structured data to organize and connect microdata based on JSON Linked Data format (JSON-LD).
Blueprint example of data type NewsArticle
Currently the following data types are available. More to come soon (or on request).
- NewsArticle
- FAQPage
- Event (in progress)
- QAPage (in progress)
- Download the plugin and put in your Kirby plugin directory (e.g.
site/plugins/
) - Add your global publisher info to the Kirby config file (
site/config/config.php
) [recommended]
'chrfickinger.jsonld-for-kirby' => [
'publisher' => [
'type' => 'Organization/Person',
'name' => 'Name',
'logo' => 'Logo URL'
]
]
- Add the block
jsonld
to a blueprint of your choice (e.g.site/blueprints/pages/default.yml
). This allows to use as many blocks as needed on the page.
jsonld:
extends: jsonld
- Add the following snippet to your output template or footer snippet. (e.g.
site/templates/default.php
orsite/snippets/footer.php
)
<?php snippet('jsonld'); ?>
Use this type, if your content is an article page about news, blog or sports. The following code snippet is automatically generated by the plugin by using type NewsArticle
. The fields in the [square brackets] in the example are replaced by Kirby's content fields.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "NewsArticle",
"headline": "[HEADLINE]",
"description": "[DESCRIPTION]",
"image": [
"[URL]"
],
"datePublished": "[DATE]",
"author": {
"@type": "Person",
"name": "[NAME]"
},
"publisher": {
"@type": "Organization",
"name": "[NAME]",
"logo": {
"@type": "ImageObject",
"url": "[URL]"
}
}
}
</script>
More information about the data type NewsArticle.
Use this type, if your page contains a list of questions and answers pertaining to a particular topic. The following code snippet is automatically generated by the plugin by using type FAQPage
. The fields in the [square brackets] in the example are replaced by Kirby's content fields.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [{
"@type": "Question",
"name": "[QUESTION]",
"acceptedAnswer": {
"@type": "Answer",
"text": "[ANSWER]"
}
}, {
"@type": "Question",
"name": "[QUESTION]",
"acceptedAnswer": {
"@type": "Answer",
"text": "[ANSWER]"
}
},
...
}
</script>
More information about the data type FAQPage.
This plugin is completely free and published under the MIT license. However, if you are using it in a commercial project and want to help me keep up with maintenance, please consider making a donation of your choice.