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 1,000,000+ packages pre-installed, including metalsmith-more with all npm packages installed. Try it out:

var metalsmithMore = require("metalsmith-more")

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

metalsmith-more v0.2.0

A Metalsmith plugin to store the content before <!--more--> in HTML files.


A Metalsmith plugin to store the content before <!--more--> in HTML files, akin to WordPress' More tag.

This plugin processes HTML files and adds a less key with the part of contents preceding the <!--more--> tag. The file extension to filter by, tag to truncate on, and key to store content in are customizable; see Options below.


$ npm install metalsmith-more

CLI Usage

Add the metalsmith-more key to your metalsmith.json file:

    "plugins": {
        "metalsmith-more": true

JavaScript Usage

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


metalsmith-more can be used with zero configuration, but it also supports the following options to customize its behavior:

  • ext - Extension to match against when examining files to operate on; default is html
  • regexp - Regular expression to truncate against; default is /\s*<!--\s*more\s*-->/. May also be specified as a string, which a RegExp will be constructed from.
  • key - Key to store truncated content in; default is less
  • alwaysAddKey - whether to always add the specified key even if a file contains no match to regexp; default is false.
    • When false, any file with no match will not contain the specified key.
    • When true, any file with no match will have the specified key's value set equal to the file's contents.

These options can be specified in an object passed to the plugin function or assigned to the metalsmith-more key in metalsmith.json.



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