Skip to content

Metalsmith plugin for making a page's file path available in the metadata.

License

Notifications You must be signed in to change notification settings

lotaris/metalsmith-filepath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

metalsmith-filepath

This is a plugin for Metalsmith that adds a link property to each page that contains the file path of the page.

Usage

If no options are supplied, the plugin normalizes the file location value of the file tree and copies it into the link property. For options, see below.

If using the CLI for Metalsmith, metalsmith-filepath can be used like any other plugin by including it in metalsmith.json. For example:

{
  "plugins": {
    "metalsmith-filepath": {
      "absolute": false,
      "permalinks": false
    }
  }
}

For Metalscript's JavaScript API, metalsmith-filepath can be used like any other plugin by attaching it to the function invocation chain on the Metalscript object. For example:

var filepath = require('metalsmith-filepath');
require('metalsmith')(__dirname)
  .use(filepath({
    absolute: true,
    permalinks: true
  })
  .build();

Options

The following options can be provided:

  • absolute (boolean) - Defines whether URLs should be prefixed with a slash (/)
  • permalinks (boolean) - Defines whether the file name should be trimmed off the URL, resulting in the path to the folder.

License

MIT, see LICENSE.

About

Metalsmith plugin for making a page's file path available in the metadata.

Resources

License

Stars

Watchers

Forks

Packages

No packages published