Skip to main content

Reusable content blocks with slot-based templating for Wagtail CMS

Project description

wagtail-reusable-blocks

PyPI version License: BSD-3-Clause

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wagtail_reusable_blocks-0.0.1.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wagtail_reusable_blocks-0.0.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

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

Hashes for wagtail_reusable_blocks-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f08e6cbe414a323d9e68ee57eb9d5c7381333f903dfce6555bb3d95e306f038f
MD5 8bd0dff43c55c56407b8df45b44a2a6b
BLAKE2b-256 0e9a7d480a73f6466b689e911437f154f8f469e383462962434daa7e2dade6b2

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wagtail_reusable_blocks-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for wagtail_reusable_blocks-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ee8f85020613d0f1bbafffd505d8793407da8e7051177f42718b04c68f168ca5
MD5 9c34f673a07601bb1a38377ef387b679
BLAKE2b-256 a2787c8b5339b8066237c3b9b8d385a1a6d18534dd0dabf50d8f46bbe37e7baf

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page