Reusable content blocks with slot-based templating for Wagtail CMS
Project description
wagtail-reusable-blocks
A Wagtail CMS extension for creating reusable content blocks with an advanced slot-based templating system.
What is this?
This package bridges the gap between Wagtail's Snippets and Page Blocks:
| Feature | Snippets | Page Blocks | Reusable Blocks |
|---|---|---|---|
| Reusable across pages | No | No | Yes |
| StreamField support | Limited | Yes | Yes |
| Single source of truth | Yes | No | Yes |
| Slot/placeholder support | No | No | Yes (v0.2.0+) |
Think of it like WordPress Gutenberg's "Synced Patterns" (formerly Reusable Blocks), but for Wagtail.
Use Cases
- Headers/Footers: Create once, use on all pages
- Call-to-Action blocks: Consistent CTAs across the site
- Promotional banners: Update in one place, reflect everywhere
- Layout templates: Define page structures with customizable slots
- Design systems: Build component libraries for content editors
Installation
pip install wagtail-reusable-blocks
Add to your INSTALLED_APPS:
INSTALLED_APPS = [
# ...
'wagtail_reusable_blocks',
# ...
]
Run migrations:
python manage.py migrate
Quick Start
1. Create a Reusable Block
Go to Snippets > Reusable Blocks in Wagtail admin and create a new block.
2. Use in Your Page Model
from wagtail.fields import StreamField
from wagtail.blocks import RichTextBlock
from wagtail_reusable_blocks.blocks import ReusableBlockChooserBlock
class MyPage(Page):
body = StreamField([
('rich_text', RichTextBlock()),
('reusable_block', ReusableBlockChooserBlock()),
], use_json_field=True)
3. Render in Template
{% for block in page.body %}
{% include_block block %}
{% endfor %}
Features by Version
v0.1.0 - MVP (Reusable Blocks)
- ReusableBlock model with StreamField support
- ReusableBlockChooserBlock for page integration
- Admin UI for managing reusable blocks
v0.2.0 - Slot System
- Define placeholders within reusable blocks
- Inject content into slots from page level
- Component composition without code changes
v0.3.0 - Performance & Polish
- Caching for optimized rendering
- Usage tracking ("where is this block used?")
- Revision support
Documentation
Project Links
Roadmap
See Project Milestones for detailed roadmap.
Requirements
- Python 3.10+
- Django 4.2+
- Wagtail 5.0+
License
BSD 3-Clause License. See LICENSE for details.
Inspiration
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wagtail_reusable_blocks-0.0.1.tar.gz.
File metadata
- Download URL: wagtail_reusable_blocks-0.0.1.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f08e6cbe414a323d9e68ee57eb9d5c7381333f903dfce6555bb3d95e306f038f
|
|
| MD5 |
8bd0dff43c55c56407b8df45b44a2a6b
|
|
| BLAKE2b-256 |
0e9a7d480a73f6466b689e911437f154f8f469e383462962434daa7e2dade6b2
|
Provenance
The following attestation bundles were made for wagtail_reusable_blocks-0.0.1.tar.gz:
Publisher:
publish.yml on kkm-horikawa/wagtail-reusable-blocks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wagtail_reusable_blocks-0.0.1.tar.gz -
Subject digest:
f08e6cbe414a323d9e68ee57eb9d5c7381333f903dfce6555bb3d95e306f038f - Sigstore transparency entry: 729313088
- Sigstore integration time:
-
Permalink:
kkm-horikawa/wagtail-reusable-blocks@f6885d667f86cf08ebc476301dd8628510e274f8 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/kkm-horikawa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f6885d667f86cf08ebc476301dd8628510e274f8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file wagtail_reusable_blocks-0.0.1-py3-none-any.whl.
File metadata
- Download URL: wagtail_reusable_blocks-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee8f85020613d0f1bbafffd505d8793407da8e7051177f42718b04c68f168ca5
|
|
| MD5 |
9c34f673a07601bb1a38377ef387b679
|
|
| BLAKE2b-256 |
a2787c8b5339b8066237c3b9b8d385a1a6d18534dd0dabf50d8f46bbe37e7baf
|
Provenance
The following attestation bundles were made for wagtail_reusable_blocks-0.0.1-py3-none-any.whl:
Publisher:
publish.yml on kkm-horikawa/wagtail-reusable-blocks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wagtail_reusable_blocks-0.0.1-py3-none-any.whl -
Subject digest:
ee8f85020613d0f1bbafffd505d8793407da8e7051177f42718b04c68f168ca5 - Sigstore transparency entry: 729313090
- Sigstore integration time:
-
Permalink:
kkm-horikawa/wagtail-reusable-blocks@f6885d667f86cf08ebc476301dd8628510e274f8 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/kkm-horikawa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f6885d667f86cf08ebc476301dd8628510e274f8 -
Trigger Event:
push
-
Statement type: