Title
shane-new-post Guide
Once shane-new-post is installed (see Install & Quick Start), it drops a scripts/new-post.js into the project. There are two ways to run it. If pnpm new-post says the script doesn’t exist, see Verify the install — the short version is that some package managers skip the setup step, and Installation Internals explains exactly why and how to finish it by hand.
Interactive mode
Section titled “Interactive mode”Run it with no arguments:
npm run new-postpnpm new-postyarn new-postYou’ll be walked through, in order:
Filename
Tags
Description / featured / draft / mdx
.md instead of .mdx).The filename is checked for path separators, illegal characters, and .. traversal — an invalid entry re-prompts instead of crashing.
Command mode
Section titled “Command mode”The filename is the only required positional argument, and it must come first. Everything after it is a key:value pair, and — unlike the filename — those pairs can be written in any order, separated by / (or split across lines with a trailing \):
pnpm new-post "getting-started" title:Getting Started/description:An intro post/tags:[astro,web]/draft:F/featured:T/mdx:TThis is exactly equivalent — same keys, different order, split with \ instead of packed onto one line:
pnpm new-post "getting-started" \ mdx:T \ featured:T \ title:Getting Started \ tags:[astro,web] \ draft:F \ description:An intro postArgument reference
Section titled “Argument reference”| Key | Alias | Required | Description |
|---|---|---|---|
title |
— | Yes | Post title. Command mode exits with an error if it’s missing. |
description |
desc |
No | Post description. Empty string if omitted. |
tags |
tag |
No | Comma-separated inside brackets: [tag1,tag2]. Empty list if omitted. |
draft |
— | No | Boolean, see below. Defaults to false. |
featured |
— | No | Boolean, see below. Defaults to false. |
mdx |
— | No | Boolean, see below. T/true creates a .mdx file; otherwise .md. |
Boolean values (draft, featured, mdx) are case-insensitive and accept the shorthand T / F alongside the full words true / false. Only t or true in any casing counts as yes — f, false, an empty value, or leaving the key out entirely all mean no. There’s no dedicated “false” check; anything that isn’t a t/true match simply falls through to the default.
Unrecognized keys (a typo, or a leftover key from shane-new-doc’s vocabulary like order) are printed as a warning and skipped — they don’t stop the post from being created.
What gets created
Section titled “What gets created”Directorysrc/
Directorycontent/
Directoryposts/
- getting-started.md new post
Directorypublic/
Directoryimg/
Directorygetting-started/ matching image folder, empty
- …
Other behavior
Section titled “Other behavior”- Refuses to overwrite an existing post with the same filename — errors out instead of touching it.
- Automatically creates a matching image folder (named after the post’s filename, without extension) for every new post.
- Supports both
.mdand.mdx; if the filename already ends in one of those, it’s used as-is and themdxflag is ignored for the extension. - Frontmatter string values (title, description, tags, author) are always quote-escaped, so a value containing a colon,
#, or quote mark won’t break the parser.