eleventy-plugin-blog

Command-line tool

Command-line tool for eleventy-plugin-blog. Add the blog to an Eleventy site, write posts, publish drafts, tidy tags, and check the site before you deploy.

You do not install it. Run it with npx in your site's folder:

npx eleventy-blog init

It needs Node.js 18.3 or later, and Eleventy 3 installed in the site.

Commands

Command What it does
init Installs the plugin, adds it to your Eleventy config, and writes a first post if there is none
new "Title" [--tags a,b] Writes a draft post under your blog folder, named after the date and title
list [--drafts] [--json] Lists posts, newest first, with date, status, and title
publish <post> Publishes a draft: removes draft: true and sets today's date. --keep-date keeps the date
tag list Lists tags with counts, and flags a tag spelled more than one way, such as Belarus and belarus
tag rename <old> <new> Renames a tag in every post, and tells you which redirect to add
studio [--open] Opens a visual editor for your posts in the browser, with a live preview. See The studio
check Builds the site into a temporary folder and reports problems: posts with no title, unreadable dates, tags spelled two ways, broken internal links, and missing images. Exits with code 1 on errors, so it can stop a deploy

<post> is a path, a file name, or part of the title. If it matches more than one post, the command lists them and changes nothing.

The studio

npx eleventy-blog studio --open

The studio runs on your computer only. It shows your posts, a visual editor, a form for the title, date, description, tags, and draft flag, and a preview from Eleventy's own dev server.

Studio options: --port <number>, --no-preview, --open.

The editor is Milkdown. The choice and its test results are in the editor trial.

Changes are shown first

Every command that changes files prints the change and asks before it writes. Pass --yes to apply without asking, for example in a script. Without a terminal and without --yes, nothing changes.

Front matter edits keep your comments, key order, and list style. Only the keys the command touches change.

Options

Option What it does
--cwd <folder> Run in another folder
--yes, -y Apply changes without asking
--help, -h Show help

Use in CI

- run: npx eleventy-blog check

Made by

Made by Lukasz Sielski. MIT licence.