Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including metalsmith-filemetadata with all npm packages installed. Try it out:

var metalsmithFilemetadata = require("metalsmith-filemetadata")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

metalsmith-filemetadata v1.0.0

Metalsmith plugin to add metadata on files based on a pattern


A Metalsmith plugin to add metadata on files based on a pattern.

BuildStatus DependencyStatus


$ npm install metalsmith-filemetadata

JavaScript usage

var fileMetadata = require('metalsmith-filemetadata');

    {pattern: "posts/*", metadata: {"section": "blogs", "type": "post"}},
    {pattern: "pages/*", metadata: {"section": "content", "type": "page"}}

The pattern property of each rule should be a valid minimatch pattern. If the pattern matches the file, the corresponding metadata are set on the file entry, For a given file, all patterns are tested, so if several rules are matching, the later can override the previously applied rules.

Adding the preserve: true to any rule will prevent overriding pre-defined values.

CLI usage

  "plugins": {
    "metalsmith-filemetadata": [
      {"pattern": "posts/*", "metadata": {"section": "blogs", "type": "post"}},
      {"pattern": "pages/*", "metadata": {"section": "content", "type": "page"}}



RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free