README
@metalsmith/drafts
A metalsmith plugin to hide drafts.
Installation
NPM:
npm install @metalsmith/drafts
Yarn:
yarn add @metalsmith/drafts
Usage
Pass the plugin with any options to Metalsmith.use
.
const drafts = require('@metalsmith/drafts')
metalsmith.use(drafts())
metalsmith.use(drafts({ default: false })) // same as default
Add draft: true
to your files' YAML front-matter to mark them as drafts:
---
title: My post
draft: true
---
draft
Default value for You can instruct @metalsmith/drafts
to mark files as draft
by default if they don't have a draft
property in their front-matter:
const drafts = require('@metalsmith/drafts')
metalsmith.use(
drafts({
default: true
})
)
CLI Usage
To use this plugin with the Metalsmith CLI, add @metalsmith/drafts
to the plugins
key in your metalsmith.json
file:
{
"plugins": [
{
"@metalsmith/drafts": {
"default": false
}
}
]
}