Define the fields once in site/blueprints/custom-fields/:
# site/blueprints/custom-fields/seo.yml
type: group
fields:
seoTitle:
label: SEO title
type: text
maxlength: 60
seoDescription:
label: SEO description
type: textarea
Use them in any blueprint, the group is replaced by its fields:
# site/blueprints/pages/article.yml
fields:
title:
type: text
seo: custom-fields/seo
tabs:
content:
fields: [title]
seo:
label: SEO
fields: [seo]
Single fields can be extended and adjusted, too:
# site/blueprints/custom-fields/date.yml
type: date
display: DD.MM.YYYY
fields:
publishedAt:
extends: custom-fields/date
label: Published at
Whole tabs work the same way:
# site/blueprints/tabs/seo.yml
label: SEO
fields:
seoTitle: text
tabs:
seo: tabs/seo
Output in a partial:
<?php // site/templates/partials/head.php ?>
<title><?= $page->seoTitle()->or($page->title()) ?></title>
<meta name="description" content="<?= $page->seoDescription()->stripTags() ?>">