Site›Blog

core

Blog

Display a list of blog posts from a content folder with sorting, filtering, and layout options

Source

import Markdoc from '@markdoc/markdoc';
import type { Node, RenderableTreeNode } from '@markdoc/markdoc';
import { createContentModelSchema, createComponentRenderable } from '../lib/index.js';
import { RenderableNodeCursor } from '../lib/renderable.js';
import { pageSectionProperties } from './common.js';

const { Tag } = Markdoc;

const sortOptions = ['date-desc', 'date-asc', 'title-asc', 'title-desc'] as const;
const layoutOptions = ['list', 'grid', 'compact'] as const;

export const blogSections = {
	preamble: 'preamble',
	headline: 'title',
	blurb: 'description',
	content: 'body',
} as const;

export const blog = createContentModelSchema({
	sections: blogSections,
	provides: ['prose'],
	attributes: {
		folder: {
			type: String,
			required: true,
			description: 'Content folder path to list blog posts from (e.g. "/blog")',
		},
		sort: {
			type: String,
			required: false,
			default: 'date-desc',
			matches: sortOptions.slice(),
			description: 'Sort order: date-desc, date-asc, title-asc, title-desc',
		},
		filter: {
			type: String,
			required: false,
			default: '',
			description:
				'Filter expression to match against frontmatter fields (e.g. "tag:javascript" or "draft:false")',
		},
		limit: { type: Number, required: false, description: 'Maximum number of posts to display' },
		layout: {
			type: String,
			required: false,
			default: 'list',
			matches: layoutOptions.slice(),
			description: 'Display layout: list, grid, or compact',
		},
	},
	contentModel: {
		type: 'sequence',
		fields: [
			{ name: 'headline', match: 'heading', optional: true },
			{ name: 'blurb', match: 'paragraph', optional: true },
		],
	},
	transform(resolved, attrs, config) {
		const headerAstNodes = [resolved.headline, resolved.blurb].filter(Boolean) as Node[];
		const header = new RenderableNodeCursor(
			Markdoc.transform(headerAstNodes, config) as RenderableTreeNode[],
		);

		const folderMeta = new Tag('meta', { content: attrs.folder });
		const sortMeta = new Tag('meta', { content: attrs.sort || 'date-desc' });
		const filterMeta = new Tag('meta', { content: attrs.filter || '' });
		const limitMeta = new Tag('meta', { content: attrs.limit != null ? String(attrs.limit) : '' });
		const layoutMeta = new Tag('meta', { content: attrs.layout || 'list' });

		const postList = new Tag('div', {}, []);

		const sectionProps = pageSectionProperties(header);
		const headerContent = header.count() > 0 ? [header.wrap('header').next()] : [];

		const children: any[] = [...headerContent, postList];

		return createComponentRenderable({
			rune: 'blog',
			tag: 'section',
			properties: {
				folder: folderMeta,
				sort: sortMeta,
				filter: filterMeta,
				limit: limitMeta,
				layout: layoutMeta,
			},
			refs: {
				...sectionProps,
				posts: postList,
			},
			children,
		});
	},
});

View packages/runes/src/tags/blog.ts on GitHub

Renders a list of blog posts from a specified content folder. Posts are automatically sorted by date and can be filtered, limited, and displayed in different layouts.

Basic usage

Point the folder attribute at a content directory containing your blog posts.

{% blog folder="/blog" %}
{% /blog %}
<section data-rune="blog" data-rune-fields="{&quot;folder&quot;:&quot;/blog&quot;,&quot;sort&quot;:&quot;date-desc&quot;,&quot;filter&quot;:&quot;&quot;,&quot;limit&quot;:&quot;&quot;,&quot;layout&quot;:&quot;list&quot;}">
  <div data-name="posts"></div>
</section>

What's New in 0.9.0

Metadata dimensions, universal theming, rune output standards, the plan package, Markdoc partials, and a Lumina design refresh.

What's New in 0.8.0

Declarative content models, a cross-page pipeline, media runes with streaming, and identity transform improvements.

What's New in 0.6.0

A full WYSIWYG editor, framework-neutral web components, layout transform engine, AI-powered theme designer, and a Python extraction pipeline.

What's New in 0.5.0

Theme development toolkit, behaviors library, six new runes, VS Code language server, and a major architecture shift toward framework-agnostic rendering.

What's New in 0.4.0

New packages, seven new runes, theme restructuring, syntax highlighting, and more.

<section class="rf-blog rf-blog--list" data-layout="list" data-sort="date-desc" data-filter="" data-limit="" data-folder="/blog" data-rune="blog" data-density="full">
  <div data-name="content" class="rf-blog__content" data-section="body">
    <div data-name="posts" class="rf-blog__posts">
      <article data-name="post" class="rf-blog__post">
        <h3>
          <a href="/blog/whats-new-in-0-9">What's New in 0.9.0</a>
        </h3>
        <time datetime="2026-03-30">2026-03-30</time>
        <p>Metadata dimensions, universal theming, rune output standards, the plan package, Markdoc partials, and a Lumina design refresh.</p>
      </article>
      <article data-name="post" class="rf-blog__post">
        <h3>
          <a href="/blog/whats-new-in-0-8">What's New in 0.8.0</a>
        </h3>
        <time datetime="2026-03-10">2026-03-10</time>
        <p>Declarative content models, a cross-page pipeline, media runes with streaming, and identity transform improvements.</p>
      </article>
      <article data-name="post" class="rf-blog__post">
        <h3>
          <a href="/blog/whats-new-in-0-7">What's New in 0.7.0</a>
        </h3>
        <time datetime="2026-03-03">2026-03-03</time>
        <p>Eight official rune packages and new tooling for package authors.</p>
      </article>
      <article data-name="post" class="rf-blog__post">
        <h3>
          <a href="/blog/whats-new-in-0-6">What's New in 0.6.0</a>
        </h3>
        <time datetime="2026-03-02">2026-03-02</time>
        <p>A full WYSIWYG editor, framework-neutral web components, layout transform engine, AI-powered theme designer, and a Python extraction pipeline.</p>
      </article>
      <article data-name="post" class="rf-blog__post">
        <h3>
          <a href="/blog/whats-new-in-0-5">What's New in 0.5.0</a>
        </h3>
        <time datetime="2026-02-23">2026-02-23</time>
        <p>Theme development toolkit, behaviors library, six new runes, VS Code language server, and a major architecture shift toward framework-agnostic rendering.</p>
      </article>
      <article data-name="post" class="rf-blog__post">
        <h3>
          <a href="/blog/whats-new-in-0-4">What's New in 0.4.0</a>
        </h3>
        <time datetime="2026-02-16">2026-02-16</time>
        <p>New packages, seven new runes, theme restructuring, syntax highlighting, and more.</p>
      </article>
    </div>
  </div>
</section>

How Markdown is read

The posts come from folder; the body only adds a header above them.

You writeIt becomes
A headingThe headline above the post list (Page sections)
A paragraph after itThe blurb
{% blog folder="/blog" layout="grid" %}

# Latest Posts

Stay up to date with the newest updates and tutorials.

{% /blog %}
<section data-rune="blog" data-rune-fields="{&quot;folder&quot;:&quot;/blog&quot;,&quot;sort&quot;:&quot;date-desc&quot;,&quot;filter&quot;:&quot;&quot;,&quot;limit&quot;:&quot;&quot;,&quot;layout&quot;:&quot;grid&quot;}">
  <header>
    <h1 id="latest-posts" data-name="headline">Latest Posts</h1>
    <p data-name="blurb">Stay up to date with the newest updates and tutorials.</p>
  </header>
  <div data-name="posts"></div>
</section>

Latest Posts

Stay up to date with the newest updates and tutorials.

What's New in 0.9.0

Metadata dimensions, universal theming, rune output standards, the plan package, Markdoc partials, and a Lumina design refresh.

What's New in 0.8.0

Declarative content models, a cross-page pipeline, media runes with streaming, and identity transform improvements.

What's New in 0.6.0

A full WYSIWYG editor, framework-neutral web components, layout transform engine, AI-powered theme designer, and a Python extraction pipeline.

What's New in 0.5.0

Theme development toolkit, behaviors library, six new runes, VS Code language server, and a major architecture shift toward framework-agnostic rendering.

What's New in 0.4.0

New packages, seven new runes, theme restructuring, syntax highlighting, and more.

<section class="rf-blog rf-blog--grid" data-layout="grid" data-sort="date-desc" data-filter="" data-limit="" data-folder="/blog" data-rune="blog" data-density="full">
  <div data-name="content" class="rf-blog__content" data-section="body">
    <header data-name="preamble" class="rf-blog__preamble" data-section="preamble">
      <h1 id="latest-posts" data-name="headline" class="rf-blog__headline" data-section="title">Latest Posts</h1>
      <p data-name="blurb" class="rf-blog__blurb" data-section="description">Stay up to date with the newest updates and tutorials.</p>
    </header>
    <div data-name="posts" class="rf-blog__posts">
      <article data-name="post" class="rf-blog__post">
        <h3>
          <a href="/blog/whats-new-in-0-9">What's New in 0.9.0</a>
        </h3>
        <time datetime="2026-03-30">2026-03-30</time>
        <p>Metadata dimensions, universal theming, rune output standards, the plan package, Markdoc partials, and a Lumina design refresh.</p>
      </article>
      <article data-name="post" class="rf-blog__post">
        <h3>
          <a href="/blog/whats-new-in-0-8">What's New in 0.8.0</a>
        </h3>
        <time datetime="2026-03-10">2026-03-10</time>
        <p>Declarative content models, a cross-page pipeline, media runes with streaming, and identity transform improvements.</p>
      </article>
      <article data-name="post" class="rf-blog__post">
        <h3>
          <a href="/blog/whats-new-in-0-7">What's New in 0.7.0</a>
        </h3>
        <time datetime="2026-03-03">2026-03-03</time>
        <p>Eight official rune packages and new tooling for package authors.</p>
      </article>
      <article data-name="post" class="rf-blog__post">
        <h3>
          <a href="/blog/whats-new-in-0-6">What's New in 0.6.0</a>
        </h3>
        <time datetime="2026-03-02">2026-03-02</time>
        <p>A full WYSIWYG editor, framework-neutral web components, layout transform engine, AI-powered theme designer, and a Python extraction pipeline.</p>
      </article>
      <article data-name="post" class="rf-blog__post">
        <h3>
          <a href="/blog/whats-new-in-0-5">What's New in 0.5.0</a>
        </h3>
        <time datetime="2026-02-23">2026-02-23</time>
        <p>Theme development toolkit, behaviors library, six new runes, VS Code language server, and a major architecture shift toward framework-agnostic rendering.</p>
      </article>
      <article data-name="post" class="rf-blog__post">
        <h3>
          <a href="/blog/whats-new-in-0-4">What's New in 0.4.0</a>
        </h3>
        <time datetime="2026-02-16">2026-02-16</time>
        <p>New packages, seven new runes, theme restructuring, syntax highlighting, and more.</p>
      </article>
    </div>
  </div>
</section>

Grid layout

Use the layout attribute to switch between list, grid, and compact display modes.

{% blog folder="/blog" layout="grid" %}
{% /blog %}
<section data-rune="blog" data-rune-fields="{&quot;folder&quot;:&quot;/blog&quot;,&quot;sort&quot;:&quot;date-desc&quot;,&quot;filter&quot;:&quot;&quot;,&quot;limit&quot;:&quot;&quot;,&quot;layout&quot;:&quot;grid&quot;}">
  <div data-name="posts"></div>
</section>

What's New in 0.9.0

Metadata dimensions, universal theming, rune output standards, the plan package, Markdoc partials, and a Lumina design refresh.

What's New in 0.8.0

Declarative content models, a cross-page pipeline, media runes with streaming, and identity transform improvements.

What's New in 0.6.0

A full WYSIWYG editor, framework-neutral web components, layout transform engine, AI-powered theme designer, and a Python extraction pipeline.

What's New in 0.5.0

Theme development toolkit, behaviors library, six new runes, VS Code language server, and a major architecture shift toward framework-agnostic rendering.

What's New in 0.4.0

New packages, seven new runes, theme restructuring, syntax highlighting, and more.

<section class="rf-blog rf-blog--grid" data-layout="grid" data-sort="date-desc" data-filter="" data-limit="" data-folder="/blog" data-rune="blog" data-density="full">
  <div data-name="content" class="rf-blog__content" data-section="body">
    <div data-name="posts" class="rf-blog__posts">
      <article data-name="post" class="rf-blog__post">
        <h3>
          <a href="/blog/whats-new-in-0-9">What's New in 0.9.0</a>
        </h3>
        <time datetime="2026-03-30">2026-03-30</time>
        <p>Metadata dimensions, universal theming, rune output standards, the plan package, Markdoc partials, and a Lumina design refresh.</p>
      </article>
      <article data-name="post" class="rf-blog__post">
        <h3>
          <a href="/blog/whats-new-in-0-8">What's New in 0.8.0</a>
        </h3>
        <time datetime="2026-03-10">2026-03-10</time>
        <p>Declarative content models, a cross-page pipeline, media runes with streaming, and identity transform improvements.</p>
      </article>
      <article data-name="post" class="rf-blog__post">
        <h3>
          <a href="/blog/whats-new-in-0-7">What's New in 0.7.0</a>
        </h3>
        <time datetime="2026-03-03">2026-03-03</time>
        <p>Eight official rune packages and new tooling for package authors.</p>
      </article>
      <article data-name="post" class="rf-blog__post">
        <h3>
          <a href="/blog/whats-new-in-0-6">What's New in 0.6.0</a>
        </h3>
        <time datetime="2026-03-02">2026-03-02</time>
        <p>A full WYSIWYG editor, framework-neutral web components, layout transform engine, AI-powered theme designer, and a Python extraction pipeline.</p>
      </article>
      <article data-name="post" class="rf-blog__post">
        <h3>
          <a href="/blog/whats-new-in-0-5">What's New in 0.5.0</a>
        </h3>
        <time datetime="2026-02-23">2026-02-23</time>
        <p>Theme development toolkit, behaviors library, six new runes, VS Code language server, and a major architecture shift toward framework-agnostic rendering.</p>
      </article>
      <article data-name="post" class="rf-blog__post">
        <h3>
          <a href="/blog/whats-new-in-0-4">What's New in 0.4.0</a>
        </h3>
        <time datetime="2026-02-16">2026-02-16</time>
        <p>New packages, seven new runes, theme restructuring, syntax highlighting, and more.</p>
      </article>
    </div>
  </div>
</section>

Filtering and sorting

Use filter to match against frontmatter fields and sort to control ordering. Limit the number of displayed posts with limit.

{% blog folder="/blog" sort="title-asc" limit=3 %}
{% /blog %}
<section data-rune="blog" data-rune-fields="{&quot;folder&quot;:&quot;/blog&quot;,&quot;sort&quot;:&quot;title-asc&quot;,&quot;filter&quot;:&quot;&quot;,&quot;limit&quot;:&quot;3&quot;,&quot;layout&quot;:&quot;list&quot;}">
  <div data-name="posts"></div>
</section>

What's New in 0.4.0

New packages, seven new runes, theme restructuring, syntax highlighting, and more.

What's New in 0.5.0

Theme development toolkit, behaviors library, six new runes, VS Code language server, and a major architecture shift toward framework-agnostic rendering.

What's New in 0.6.0

A full WYSIWYG editor, framework-neutral web components, layout transform engine, AI-powered theme designer, and a Python extraction pipeline.

<section class="rf-blog rf-blog--list" data-layout="list" data-sort="title-asc" data-filter="" data-limit="3" data-folder="/blog" data-rune="blog" data-density="full">
  <div data-name="content" class="rf-blog__content" data-section="body">
    <div data-name="posts" class="rf-blog__posts">
      <article data-name="post" class="rf-blog__post">
        <h3>
          <a href="/blog/whats-new-in-0-4">What's New in 0.4.0</a>
        </h3>
        <time datetime="2026-02-16">2026-02-16</time>
        <p>New packages, seven new runes, theme restructuring, syntax highlighting, and more.</p>
      </article>
      <article data-name="post" class="rf-blog__post">
        <h3>
          <a href="/blog/whats-new-in-0-5">What's New in 0.5.0</a>
        </h3>
        <time datetime="2026-02-23">2026-02-23</time>
        <p>Theme development toolkit, behaviors library, six new runes, VS Code language server, and a major architecture shift toward framework-agnostic rendering.</p>
      </article>
      <article data-name="post" class="rf-blog__post">
        <h3>
          <a href="/blog/whats-new-in-0-6">What's New in 0.6.0</a>
        </h3>
        <time datetime="2026-03-02">2026-03-02</time>
        <p>A full WYSIWYG editor, framework-neutral web components, layout transform engine, AI-powered theme designer, and a Python extraction pipeline.</p>
      </article>
    </div>
  </div>
</section>

Attributes

AttributeTypeRequiredDescription
folderstring✓Content folder path to list blog posts from (e.g. "/blog")
sort"date-desc" | "date-asc" | "title-asc" | "title-desc"—Sort order: date-desc, date-asc, title-asc, title-desc
filterstring—Filter expression to match against frontmatter fields (e.g. "tag:javascript" or "draft:false")
limitnumber—Maximum number of posts to display
layout"list" | "grid" | "compact"—Display layout: list, grid, or compact

Universal attributes

bg

The background layer: image, video, gradient, flat overlay wash and legibility scrim, in a single injected layer behind the rune's content.

AttributeTypeRequiredDescription
bgstring—Background preset applied to this block
bg-fromstring—Gradient start colour — a semantic token name (→ var(--rf-color-*))
bg-gradient"to-t" | "to-b" | "to-l" | "to-r" | "to-tr" | "to-br" | "to-bl" | "to-tl"—Gradient direction (bounded named set)
bg-gradient-type"linear" | "radial" | "conic"—Gradient type
bg-tostring—Gradient end colour — a semantic token name
bg-viastring—Optional middle gradient stop — a semantic token name
scrim"top" | "bottom" | "left" | "right" | "none"—Scrim direction (heaviest edge); presence turns the scrim on, "none" opts out of the default cover scrim
scrim-blur"none" | "sm" | "md" | "lg"—Frost scrim blur amount
scrim-strength"sm" | "md" | "lg"—Gradient scrim strength
scrim-tone"dark" | "light"—Whether the scrim darkens (for light text) or lightens (for dark text)
scrim-type"gradient" | "frost"—Scrim treatment: gradient (default) or frost (backdrop blur)
dropcap

Per-instance drop-cap opt-in.

AttributeTypeRequiredDescription
dropcapboolean—Style the opening letter of a prose body as a drop cap. Honoured only when the body reads as prose; ignored otherwise.
elevation

How far the rune sits off the page, from sunken to overlay. The theme decides what each step looks like.

AttributeTypeRequiredDescription
elevation"sunken" | "flush" | "flat" | "raised" | "floating" | "overlay" | "none" | "sm" | "md" | "lg"—Surface depth, from sunken to overlay. Deprecated: none, sm, md and lg (read as flat, raised, raised and floating)
inset

Internal padding override.

AttributeTypeRequiredDescription
inset"flush" | "tight" | "default" | "loose" | "breathe"—Inner padding of this block
motion

Scroll-reveal entrance. You choose its character; the theme decides how it moves.

AttributeTypeRequiredDescription
reveal"none" | "fade" | "slide" | "scale" | "blur"—Scroll-reveal entrance character (none|fade|slide|scale|blur); the theme owns the choreography
staggerboolean—Cascade this block's items in as it reveals (no-op on single-child runes)
prominence

Header emphasis. Scales a rune's header, or its featured quotation; the theme decides the type size for each step.

AttributeTypeRequiredDescription
prominence"quiet" | "normal" | "prominent" | "display" | "marquee"—Emphasis of a page-section header or a featured quotation (only on runes that have one)
reading

Editorial register for body text. You pick the register; the theme decides how it looks.

AttributeTypeRequiredDescription
reading"fine" | "ui" | "prose"—Reading register for this block’s body: fine | ui | prose. The theme sets how each one looks.
spacing

Block-level rhythm override.

AttributeTypeRequiredDescription
spacing"flush" | "tight" | "default" | "loose" | "breathe"—Vertical spacing above and below this block
substrate

Generated pattern fills behind the content, drawn by the theme.

AttributeTypeRequiredDescription
substrate"dots" | "grid" | "lines" | "cross" | "checker" | "none"—Generated surface pattern
substrate-fill"inherit" | "inset"—Surface fill the pattern sits on (full colour stays with tint)
substrate-opacity"sm" | "md" | "lg"—Pattern ink strength
substrate-size"sm" | "md" | "lg"—Pattern cell size
substrate-target"self" | "media"—Which surface the pattern fills (overrides the rune/theme default)
tint

Per-rune colour override: a named tint from the theme registry, with inline per-token overrides layered on top.

AttributeTypeRequiredDescription
tintstring—Color tint preset applied to this block
tint-mode"auto" | "dark" | "light"—Whether the tint adapts to auto, dark, or light mode
width

The track a block rune occupies.

AttributeTypeRequiredDescription
width"compact" | "narrow" | "content" | "wide" | "full"—Maximum width constraint for this block
Not availableWhy
framethis rune declares neither a `frameTarget` nor a media section