Before v0.4.8, xfm new could only create posts. Wanting an About page meant copying a post, editing the front-matter, and hoping you didn't forget type: page — because if you did, the page would quietly show up in the post list, RSS and the search index. This release makes content creation a first-class command, aligned with Hexo's xfm new [layout] <title> shape.
What this release solves
The reach of the create command defines how pleasant day-to-day writing feels. Pages and drafts were both faked by hand, with the critical front-matter keys maintained from memory. v0.4.8 turns every one of those implicit conventions into an explicit command.
What changed
Added
xfm new [layout] <title>— pages and drafts finally have their own command form:xfm new page aboutcreatescontent/about.md, published at/about/xfm new draft "Half an idea"creates a post withdraft: truexfm new "Hello"andxfm new post "Hello"still create posts, unchanged- Use
--layout=when the title itself starts with a layout name;--dir=still places the file in any subdirectory.
- Pages get
layout: page.htmlandtype: pageautomatically: they have their own URL and can be added tosite.nav, but never appear in the post list, RSS, JSON Feed, related posts or the search index. - A
scaffolds/directory:xfm newnow takes its initial content fromscaffolds/<layout>.mdin your site, with{{ title }}/{{ date }}/{{ layout }}placeholders — exactly like Hexo.xfm createwrites the three default scaffolds for you to edit; sites without the directory fall back to the built-in templates. - Front-matter keys a custom scaffold omits (title, date, layout,
type: page, draft) are filled in automatically, so a bare scaffold can't silently produce a page that behaves like a post or a draft that gets published.
Changed
xfm newprints the layout and the resulting URL ([page] → /about/), names the scaffold it used, and suggests the right command when the first word looks like a misspelled layout.- A multi-word title stays whole:
xfm new 我的 文章creates 「我的 文章」 instead of dropping everything after the first word. A single argument is always a title (xfm new pageis a post named "page"), matching Hexo. - The starter post body no longer repeats the
# H1the theme already renders frompage.title.
Do you need to do anything
No breaking changes — existing commands behave exactly as before. Two things are worth doing: create pages with xfm new page <title> from now on, and consider moving your hand-rolled templates into scaffolds/ to benefit from the placeholder filling. Full command reference in the CLI guide.
Comments