5.5.2
Content
Edit Dispatch's content in Markdown, or switch it to EmDash. Set who can read each story.
Markdown
By default, the content is in Markdown, JSON and YAML files in content/:
content/posts/: stories (.mdor.mdx). Each story is an issue.content/authors/: writers.content/series/: series.content/pages/: pages such as About, Privacy and Terms.content/home.yaml: the home page: the hero’s stories, “Most read this month”, the writer beside Latest and up to three section cards.content/plans.json: the plans on/plans.content/site.json: the publication’s details, such as its name, tagline, social links and the newsletter form URL.content/menus.jsonandcontent/taxonomies.json: menus, sections and tags.content/media/: images.
A story
A story has a title, a date, an excerpt, a photo (image), its writers (authors), its sections (topics) and tags, an access level (access) and an optional preview:
---
title: The night shift
date: 2026-10-02
excerpt: From eleven until the first bus, Rosa's belongs to the drivers.
image: ../media/photos/studio-desk.webp
imageAlt: A laptop and a framed print on a light wood desk
access: members
authors:
- ruth-calloway
series:
ref: the-last-diners
part: 2
topics:
- food
tags:
- transport
---
Sections have their own pages and show on the story. Tags are for the feed and search only; they have no page. A story in a series names the series and its part. Set draft: true to leave a story out.
Who can read a story
access is public (the default), members or paid. A members or paid story is locked unless your code says the reader may read it.
A locked story’s page shows the title, the photo, the date, the writers and the series part. Then it shows the preview, fading out, and a members card. The preview is the story’s preview field, or else its first paragraph. Nothing after the cut is in the page. Lists, the feed, the sitemap, search and share images always show the public view.
On a locked members story, the button goes to /subscribe. On a locked paid story, it goes to upgradeHref in content/site.json, or else to /plans. A “Sign in” link shows when signInHref is set.
With Markdown, locked stories stay locked. A static site is built once, for everyone, so it cannot tell who is reading. Its members and paid stories always show the preview and the members card.
To open stories to members, use EmDash. With EmDash, the site runs on a server and can ask who is reading. Write a canRead function in src/content/access.ts. It gets the story and the request, and it asks your newsletter service if the reader is a member. It returns "allow" (the story), "preview" (locked, with the preview) or "deny" (locked, no preview). It is empty by default, so every locked story stays locked. The file has an example.
Two limits:
- Images and files in a locked story are public to anyone who has their URL. No public page, feed or search result names them. Keep secrets out of them.
- A story you change from public to locked can still be served from a cache until the cache clears. Keep cache times short on story pages.
Write a fresh excerpt for a locked story. An excerpt that reuses a run of eight words from the locked text is dropped, and the excerpt then comes from the preview.
Switch to EmDash
EmDash is a CMS built on Astro, with an admin UI. To use it, change the source in astro.config.mjs:
const content = await contentSource(process.env.CONTENT_SOURCE ?? "emdash", import.meta.url);
Then load the demo content and images into a local database (data.db):
pnpm seed:emdash
pnpm dev
The admin UI is at http://localhost:4321/_emdash/admin. The settings that EmDash’s site settings do not have (the newsletter form, the sign-in and upgrade links, the social links) are in the Publication details.
pnpm test:parity builds the site from each source and checks that they give the same content and pages.
With Markdown, the build is a static site. With EmDash, the build is a server app for Node. See Deploy.
Newsletter service
The sign-up forms on the home page and on /subscribe post the reader’s email to your newsletter service. Set the form URL as newsletterAction in content/site.json. In EmDash, this is “Newsletter form URL” in the Publication details. Without it, the forms are hidden. /subscribe says how to set it, and a live site offers its RSS feed instead.
The demo sets https://example.com/dispatch/... for the form, the upgrade link, the sign-in link and the plans’ links. These are placeholders. Replace them with your service’s addresses.
Until the site is live (no SITE_URL, or your own machine), the form sends nothing and says it is a demo. Once the site is live, no form renders. The page offers RSS, with words that promise no email.
On any site, no link goes to a placeholder:
- The upgrade button goes to
/plans. - The sign-in link is hidden.
- A writer’s link or a social link is hidden.
- A free plan’s button goes to
/subscribe. - A paid plan’s button is disabled, with a note.
A live site also hides a social link to a site’s home page, such as https://www.instagram.com. Set your profile’s address.
The server’s log or the build’s log names each one.
Plans
/plans shows the plans in content/plans.json: a name, a price and its period, a list of features, a link to your service’s checkout page (href) and an order. Set highlighted: true on the one plan to point at. In EmDash, plans are a collection.
Privacy and terms pages
The privacy and terms pages are demo text for a made-up publication. They are in content/pages/privacy.md and content/pages/terms.md, and in the EmDash seed. Do not publish them as they are. Their claims must match your own setup and your newsletter service. If you are not sure what they must say, ask someone who knows the law where you work.
The /system page
Run pnpm dev, then open /system. It shows the colors, type, components and sections, and the Subscribe, Plans and Search screens. A build leaves it out unless you set ASTRONOMIC_SYSTEM=1.