Skip to content
Available for new work
Pages in Blog

ConceptPremium

Blocks and Blade rendering in CoullWorks Blog for Laravel

How posts are stored as typed blocks, which block types exist, and how the Blade front end renders and overrides them.

Updated 16 November 2026Back to the package pageBuy

Using the block editor is covered step by step in The block editor, and every block type has its own section with every field in text blocks, media blocks and layout blocks.

How posts are stored#

A post body is a list of blocks. Each block has a type, a version and typed data:

json
{ "type": "coullworks.text", "v": 1, "data": { "body": "<p>First paragraph.</p>" } }

Blocks are validated on save and their text is sanitised. The editor specification, the validation and the registry all come from the block types, so a field is declared once. A document is capped at 200 blocks by default (coullworks-blog.blocks.max_blocks), and blocks nested inside columns count towards that cap.

Block types#

The package ships blocks for layout, text, media and article furniture:

  • Layout. Section, columns (2 to 4 columns, each holding up to 20 blocks), divider, banner.
  • Text. Heading, text, quote, callout, takeaways, table of contents, FAQ, table.
  • Media. Image (a bare image with required alt text unless marked decorative), figure (image with caption, credit and a second image for phones), gallery, video, embed.
  • Other. Code, products, call to action, HTML.

Columns render side by side from 768px and stacked below, in source order, so reading order and keyboard order are column 1 then column 2.

Code blocks#

The package ships its own small tokenizer (about 13 KB, no dependency, no network). A post page requests it once, and only when the document holds a code block. Without JavaScript the code is plain readable text. Optional fields give line numbers and marked lines such as 2-3,5.

Embeds#

Embed providers are an allow-list (coullworks-blog.blocks.embed_providers: X, Bluesky, CodePen, Gist, Spotify, Loom by default). A blog can override the list in its settings.

Product blocks#

The package has no catalogue. A products block either lists references or names a rule your application provides. Bind a ProductProvider to turn references into cards, and optionally a ProductRuleProvider for named rules. A stored rule block whose rule has gone is kept unchanged, shows nothing on the page, and is counted on the dashboard widget "Broken internal links".

Rendering with Blade#

Set coullworks-blog.frontend to blade. Pages are server rendered: listing, article, category, tag, author, archive, search, not found, feed and sitemap.

  • Publish a view set (vendor:publish --tag=cwb-blade-views-tailwind, or the Bootstrap set) and edit it. A host copy in resources/views/vendor/coullworks-blog wins over the package view.
  • Set coullworks-blog.blade.layout to use your own layout.
  • Tokens are CSS custom properties prefixed --cw-. Change a token and every page follows.

The full guides are Choosing a front end, Blade, Tokens and theming and Views and slots.

Custom block types#

Register your own by listing class names that implement BlockType in coullworks-blog.blocks.custom. Types you list under coullworks-blog.blocks.disabled are hidden from the picker, but stored content of a disabled type still validates, indexes and renders.

Available for new work

UK based · PHP · Python · JS · TS. Every first call is free.