Learn ← All posts
Post

Posts are just files

blog · markdown · files

A post is a folder, the list is a marker, and the metadata is a JSON file.

The Learn section is not a CMS and has no database. A post is a directory with a page in it:

public/learn/<slug>/index.html     the rendered page
posts.json                         title, date, tags, summary, body
public/learn/index.html            the list, between two markers

Publishing

One function takes a title, a body and tags. It slugifies the title, renders the body to HTML, writes the page, prepends the metadata to posts.json, and rewrites the block between &lt;!--posts:start--&gt; and &lt;!--posts:end--&gt; in the list page. The sitemap is regenerated from the same metadata in the same pass.

Nothing restarts. The files are the site.

The format

Bodies are a small subset of Markdown — headings, lists, quotes, fenced code, bold, italic, links — plus the blocks I actually wanted:

  • !hook one line — the line at the top of a post, reused as the list summary
  • &gt; [!NOTE] Title for callouts (TIP, WARN and DANGER get a heavier left rule — still black and white)
  • images, banners, video files, and YouTube or Vimeo embeds by URL
  • --- for a section break

Rendering escapes everything first and then puts back a fixed set of tags, so a body can't inject markup. Links are limited to http(s) and site-relative paths — a pasted javascript: URL is dropped rather than trusted.

Editing

The file on disk is the source of truth, so anything that can write a file can publish. In practice that is a Discord command, a shell one-liner, or the site itself, and all three call the same module, so they cannot disagree about what a post looks like.