# Reusable patterns from template files

The same HTML as pages, straight into the inserter.

## Template files, not registration code

Create a folder with `pattern.json` and a template. Blockstudio registers it without `register_block_pattern()` boilerplate.

Patterns insert real editable blocks, giving users a customizable starting layout while the source remains version controlled.

[Pattern syntax](https://blockstudio.dev/docs/pages-and-patterns/patterns/)

index.php

```
<div>
  <h2>Pricing</h2>
  <p>Simple, transparent pricing.</p>
  <block name="core/columns">
    <block name="core/column"><h3>Starter</h3></block>
    <block name="core/column"><h3>Pro</h3></block>
  </block>
</div>
```

## Same syntax as pages

Standard HTML maps to core blocks; the block tag handles everything else.

## Auto-registered

Drop in a template and pattern.json; it appears automatically.

## Fully editable

Users customize each inserted pattern independently.

## Categorized and searchable

Categories and keywords make patterns discoverable.

## Any block, any nesting

Use core, custom, or Blockstudio blocks at any depth.

## Post type restrictions

Limit patterns to the post types where they belong.

## Block associations

Associate patterns with block types so they appear as suggestions.

## Version controlled

Track pattern files in Git and deploy them across environments.

## Configure with pattern.json

Set title, description, categories, keywords, viewport width, post types, and block types in `pattern.json`. Control inserter visibility in the same file.

Categories organize patterns; keywords make them searchable; viewport width controls the preview.

[Pattern configuration](https://blockstudio.dev/docs/pages-and-patterns/patterns/)

pattern.json

```
{
  "name": "pricing-table",
  "title": "Pricing Table",
  "description": "Two-column pricing layout",
  "categories": ["featured", "commerce"],
  "keywords": ["pricing", "plans", "table"],
  "viewportWidth": 1200,
  "blockTypes": ["core/group"],
  "postTypes": ["page", "landing"]
}
```

## Blade and Twig sources

Write a pattern, page, or Site Editor template as `index.blade.php` or `index.twig` instead of `index.php`. Blade renders through `Blockstudio\Blade_Renderer` with `illuminate/view` 8 through 12, and Twig needs Timber.

Sources compile without request context, so they have no dynamic variables. Use them for the engine’s built-in functions and filters.

[Template engines](https://blockstudio.dev/docs/pages-and-patterns/#template-engines)

patterns/pricing/index.blade.php

```
<div>
  <h2>{{ strtoupper('Pricing') }}</h2>
  <p>Simple, transparent pricing.</p>
</div>
```

## Custom templates editors can pick

A `template.json` whose slug is outside the template hierarchy becomes a custom template. List the post types in `postTypes`, and editors choose it in the template selector.

`Blockstudio\Site_Templates` reads and compiles the sources from PHP, so tests and deployment checks can inspect the compiled markup and call `selection_errors()` for the items they asked for.

[Site Editor templates guide](https://blockstudio.dev/guides/site-editor-templates/)

templates/page-landing/template.json

```
{
  "slug": "page-landing",
  "title": "Landing Page",
  "description": "Full-width page without a header",
  "postTypes": ["page"]
}
```

## Custom discovery paths

Filters add roots for pages, patterns, and Site Editor templates, for example from a plugin.

## Logical discovery sources

Previews, overlays, and generated themes can hand Blockstudio a composed file inventory instead of one theme folder.

## Lifecycle hooks

Actions fire after patterns register and after a page post is created, updated, synced, or reconciled.

## Pattern API

Blockstudio\Patterns::patterns() and get_pattern() read the registered patterns from PHP.

Plus

## The official extension kit

Premium site templates, AI system instructions, and a private Discord community. One-time purchase, lifetime updates.

- 500+ site templates
- AI system instructions
- Lifetime updates
- Private Discord community

[Get Plus](https://blockstudio.dev/plus/)
