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.
- Your files stay clean. On save, the studio merges your edit into the original file, so lines you did not touch keep their exact formatting. Front matter you did not edit keeps its bytes.
- Format from the toolbar. Text style (paragraph or heading), bold,
italic, strikethrough, inline code, link, bulleted and numbered lists,
quote, code block, divider, image, undo, and redo. Buttons show what
applies at the cursor. Press Ctrl+K (⌘K on a Mac) to add or change a
link; Markdown shortcuts such as
##and**bold**also work. - Posts the editor would change open in Source view. Some Markdown, such as unusual list indentation, reads differently in a visual editor. The studio checks each post when it opens it, and shows those as plain Markdown instead.
- Drop images into a post. They are saved next to your posts in
images/. Change this with--images <folder>and--images-url <prefix>, and make sure Eleventy copies that folder, for example withaddPassthroughCopy. - Nothing leaves your computer. The studio listens on
127.0.0.1only, needs the private address it prints, and never commits, pushes, or deploys. Publish setsdraftoff and today's date, then saves. - It will not overwrite outside edits. If a file changed on disk since you opened it, saving stops and asks you to reload it.
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.