Remove pages from Metalsmith collections, but still allow them to build
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.editorconfig
.eslintrc
.gitignore
.travis.yml
LICENSE.md
README.md
package.json

README.md

metalsmith-unlisted

Build Status

Remove pages from collections, but still allow them to build. Useful for writing draft weblog posts and sharing with people, while not updating your listings or RSS feed.

Usage

var Metalsmith = require('metalsmith');
var permalinks = require('metalsmith-unlisted');

var metalsmith = new Metalsmith(__dirname)
  .use(unlisted());

Then add an unlisted property to the metadata for the files in your collections that you want to remove from the listings. For example:

---
title: My upcoming post
unlisted: true
---

Any truthy value will cause the file to be removed from the collection.

Options

If you don't want to use unlisted as the metadata property, you can override the name by setting the property option:

var metalsmith = new Metalsmith(__dirname)
  .use(unlisted({
    property: 'private'
  }));

CLI

You can also use the plugin with the Metalsmith CLI by adding a key to your metalsmith.json file:

{
  "plugins": {
    "metalsmith-unlisted": {
      "property": "private"
    }
  }
}

Debugging

If it doesn't seem to be working, turn on debug logging:

DEBUG=metalsmith-unlisted node build.js

This should print out enough information to help you diagnose the problem.

License

MIT