Настройка Blueprints и Fieldsets Statamic
Blueprints — схемы полей для Collections, Globals, Taxonomies, Users. Fieldsets — переиспользуемые группы полей, которые импортируются в Blueprints.
Blueprint
# resources/blueprints/collections/blog/post.yaml
title: Post
sections:
main:
display: Main
fields:
- handle: title
field:
type: text
required: true
display: Заголовок
instructions: Используется как H1 и og:title
- handle: content
field:
type: bard
display: Содержание
sets:
article_sets:
display: Article
sets:
pull_quote:
display: Pull Quote
fields:
- handle: quote
field: { type: text }
- handle: attribution
field: { type: text }
code_block:
display: Code Block
fields:
- handle: language
field:
type: select
options: [php, javascript, python, bash, yaml, json]
- handle: code
field: { type: code }
- handle: featured_image
field:
type: assets
container: assets
max_files: 1
display: Главное изображение
validate: [image]
sidebar:
display: Sidebar
fields:
- handle: categories
field:
type: terms
taxonomies: [categories]
max_items: 3
- handle: author
field:
type: users
max_items: 1
- import: seo
prefix: seo_
Fieldset — переиспользуемые поля
# resources/fieldsets/seo.yaml
title: SEO
fields:
- handle: title
field:
type: text
display: SEO Title
instructions: Если пусто — используется основной заголовок
character_limit: 70
- handle: description
field:
type: textarea
display: Meta Description
character_limit: 160
- handle: og_image
field:
type: assets
container: assets
max_files: 1
display: OG Image
instructions: 1200×630px, используется в соцсетях
validate: [image]
- handle: canonical_url
field:
type: text
display: Canonical URL
instructions: Оставьте пустым для автоматической canonical
- handle: noindex
field:
type: toggle
display: Скрыть от поисковиков
default: false
Импорт Fieldset в Blueprint:
# В секции Blueprint
- import: seo # поля без префикса
- import: seo # с префиксом
prefix: seo_
Типы полей Statamic
| Тип | Описание |
|---|---|
text |
Строка |
textarea |
Многострочный текст |
bard |
Rich text (ProseMirror) с кастомными сетами |
markdown |
Markdown-редактор |
code |
Поле с подсветкой кода |
assets |
Файлы/изображения |
entries |
Ссылки на записи других коллекций |
terms |
Ссылки на таксономии |
users |
Ссылки на пользователей |
date |
Дата/время |
time |
Время |
toggle |
Переключатель |
select / radio / checkboxes |
Варианты выбора |
color |
Цвет |
range |
Диапазон |
table |
Редактируемая таблица |
replicator |
Повторяемые наборы полей |
grid |
Повторяемые строки |
link |
Внутренние/внешние ссылки |
video |
URL видео (YouTube/Vimeo embed) |
yaml |
Произвольный YAML |
Настройка Blueprints для 5–8 коллекций с переиспользуемыми Fieldsets — 1–2 дня.







