Skip to content
A metalsmith plugin to retrieve resources (collections, singletons, etc) from the Cockpit API
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


A Metalsmith plugin to retrieve content from the Cockpit API


npm install --save metalsmith-cockpit

Or if you prefer to use Yarn...

yarn add metalsmith-cockpit

CLI Usage

    "plugins": {
        "metalsmith-cockpit": {
            "resourceType": "collections",
            "resourceName": "posts",
            "resourceFilter: { "published": true },
            "destination": "./articles"

JavaScript Usage

const metalsmith = require('metalsmith')
const cockpit = require('metalsmith-cockpit')

    cockpitApiUrl: process.env.COCKPIT_API_URL,
    cockpitApiToken: process.env.COCKPIT_API_TOKEN,
    resourceType: 'collections',
    resourceName: 'posts',
    resourceFilter: { published: true },
    destination: './articles'

Available Options

  • cockpitApiUrl - required
  • cockpitApiToken - required
    • Valid API token to GET the required resource type / name
  • resourceName - required
    • The name of the resource in Cockpit (this will be the collection name, singleton name, etc)
  • resourceType - default collections
    • The type of resource we're retrieving - must be a valid type within Cockpit (collections, forms, singletons)
  • resourceFilter - default {}
    • A hash of filters that will be included in the request to the Cockpit API (e.g. `{ published: true })
  • destination - default ./
    • The directory the entries will be output into
  • collection - default resourceName
    • If you're using the metalsmith-collections plugin you can set the name of the collection entries will be added to via metadata
You can’t perform that action at this time.