Skip to main content

A collection of reusable custom StreamField blocks for Wagtail.

Project description

Wagtail Extended Blocks

A collection of reusable custom StreamField blocks that extend Wagtail's default block types to provide greater layout flexibility and versatility.

Compatibility

Wagtail Version Django Version Python Version
5.2 (LTS) 4.2, 5.0 3.8 - 3.12
6.0+ 4.2 - 5.1 3.10 - 3.12

Resources

Installation

Install the package via pip (for local development):

pip install -e .

Add wagtail_extended_blocks to your Django settings INSTALLED_APPS:

INSTALLED_APPS = [
    # ...
    "wagtail_extended_blocks",
    # ...
]

Usage

Import and use the blocks in your StreamFields:

from wagtail.models import Page
from wagtail.fields import StreamField
from wagtail_extended_blocks.blocks import (
    QuoteBlock,
    AccordionBlock,
    ButtonChooserBlock,
)

class MyPage(Page):
    body = StreamField([
        ('quote', QuoteBlock()),
        ('accordion', AccordionBlock()),
        ('button', ButtonChooserBlock()),
    ], use_json_field=True)

Default Templates

This package includes basic default frontend HTML templates for rendering blocks. You can override any of these by placing templates inside your project's directory structure: templates/wagtail_extended_blocks/blocks/ (e.g., templates/wagtail_extended_blocks/blocks/quote_block.html).

Provided Blocks

The package organizes blocks into three categories:

Base/Utility Blocks

  • RelativeOrAbsoluteURLBlock: A text field validating external URLs, relative links (/about), anchors (#contact), or mailto links.
  • ButtonBlock: A custom link button.
  • ButtonChooserBlock: A link button allowing selection of EITHER an internal page OR a custom URL.
  • InternalButtonBlock: A button linking only to internal pages.
  • SectionBreakBlock: Inserts adjustable vertical spacing.
  • ClearfixBlock: Clear floated layouts.
  • CustomCodeBlock: Inserts custom styles or scripts.
  • CustomHtmlBlock: Paste raw HTML safely.

Content Blocks

  • QuoteBlock: Standard blockquote text with author attribution.
  • QuoteImageBlock: A layout combining an image and rich text quote.
  • FootnoteBlock: Styled text specifically for footnotes.
  • TwoColumnTextBlock: Side-by-side rich text columns.
  • FlexGridBlock: A flexible grid of rich text blocks.
  • CaseStudyBlock: Title, body text, image, and CTA link.
  • CalloutBlock: Small styled callout row.
  • CalloutRowMediumBlock: Callout row featuring a CTA button.
  • CalloutRowBlock: Callout with left image, right text, and CTA button.
  • CalloutRowLightBlock: Full-width callout row, light style, with button.
  • CalltoactionBlock: Banner CTA block with customizable classes.
  • MetacontentBlock: Rich text blocks intended for the footer or end of articles.
  • AccordionBlock: Collapsible accordion items list.

Media Blocks

  • ImageLinkedBlock: Renders an image linking to external or relative URLs.
  • ImageTextBlock: Image aligned side-by-side with rich text.
  • ImageAlignedBlock: Aligns an image left, right, center, or full width.
  • ImageGridBlock: Layout gallery for multiple images at a set width.
  • ProfileBlock: Biography box containing name, title description, photo, and bio text.
  • ProfileGridBlock: A grid layout displaying multiple user profiles.
  • ImageGalleryBlock: List of gallery items with captions.
  • VideoPromoTileBlock: Video card with thumbnail aspect ratio, title description, and internal page link.
  • NextPreviousBlock: Pagination buttons for navigating between pages.
  • DownloadBlock: File download link button.
  • RelatedContentBlock: Grid tiles linking to other articles or external sites.
  • ProgramBlock: Icon or logo block with details.

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_extended_blocks-0.1.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

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

wagtail_extended_blocks-0.1.0-py3-none-any.whl (25.4 kB view details)

Uploaded Python 3

File details

Details for the file wagtail_extended_blocks-0.1.0.tar.gz.

File metadata

  • Download URL: wagtail_extended_blocks-0.1.0.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.3

File hashes

Hashes for wagtail_extended_blocks-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0f7f3d746f2a418bbc1aeb03fbd70a0034130f59b3b341228b6c623b112a19e4
MD5 9dd1398d812c437f35e04829d805556c
BLAKE2b-256 28c855061935e655bf2ab7cc9e2e74cf9df099403dbf6cba0a1ca6c51a4ad2cc

See more details on using hashes here.

File details

Details for the file wagtail_extended_blocks-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for wagtail_extended_blocks-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3399c7317e96d15769024aad07ab4f03460072bf2a6d139b60d4c30a61e43d3c
MD5 55896666bb0c83e7ec57370db96065d3
BLAKE2b-256 83ae99ec6527c8ab7477ae118436403f0766b343b529912e6072081170cafd6b

See more details on using hashes here.

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