Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

metalsmith-metafiles

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metalsmith-metafiles

A Metalsmith plugin to read file metadata from separate files (as an alternative to frontmatter)

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

metalsmith-metafiles Build Status

A Metalsmith plugin to read file metadata from separate files (as an alternative to frontmatter).

For example, when using this plugin you could add metadata to a file named index.html by creating a file named index.html.metadata.json and putting your metadata in that file.

Installation

npm install --save metalsmith-metafiles

CLI Usage

After installing metalsmith-metafiles, simply add the metalsmith-metafiles key to the plugins in your metalsmith.json file. Be sure to include it before any plugins which need to use the metadata in your metadata files. Generally speaking, this means that metalsmith-metafiles should be the first plugin in the list.

{
  "frontmatter": false, // Optionally disable frontmatter parsing
  "plugins": {
    "metalsmith-metafiles": {
      // Options here
    },
    // Other plugins...
  }
}

JavaScript Usage

After installing metalsmith-metafiles, you can require metalsmith-metafiles in your code, then call the exported value to initialize the plugin and pass the result to Metalsmith.use (just as you would with any other Metalsmith plugin). Again, be sure to use metalsmith-metafiles before any plugins which need to use the metadata defined your metadata files. Generally speaking, this means that metalsmith-metafiles should be the first plugin in the list.

var metafiles = require('metalsmith-metafiles');

Metalsmith(__dirname)
  .frontmatter(false) // Optionally disable frontmatter parsing
  .use(metafiles({
    // Options here
  }))
  .use(/* Other plugins... */)
  .build(function(err) {
    if (err) throw err;
  });

Options

metalsmith-metafiles supports the following configuration options:

deleteMetaFiles

Type: Boolean

Default: true

Determines whether metadata files are removed from the generated site.

For example, setting this option to false would result in your .metadata.json files being put in your destination directory when you build the site. (Unless of course they're removed by some other plugin.)

postfix

Type: String

Default: .metadata

The postfix added to filenames to indicate they are metadata files. This doesn't include the file extension, only the extra text before the extension.

For example, setting this option to .m would allow you to use *.m.json files to store file metadata instead of *.metadata.json files. Values without a . in them are also allowed. For example, meta would result in *meta.json being used to store metadata.

prefix

Type: String

Default: ""

The prefix added to filenames to indicate they are metadata files.

For example, setting this option to "m-", in combination with the default postfix value of ".metadata", would result in m-*.metadata.json files being used to store metadata.

License

MIT (See LICENSE file)

Keywords

FAQs

Package last updated on 07 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc