metalsmith-move

1.0.0 • Public • Published

metalsmith-move

nodei.co

npm github-issues stars forks

metalsmith plugin to edit file paths

install

npm i --save metalsmith-move

usage

The plugin accepts a single argument in the form {src: format, ...} like so:

metalsmith.use(move({
  'articles': '{-title}{ext}',
  'pages': '{relative}/{base}'
}))

this call would move paths like this:

articles/one.html           >   article-one-title.html
articles/two.html           >   article-two-title.html
pages/about/projects.html   >   about/projects.html

src can be any multimatch mask. format can be any metalsmith-interpolate format string.

tokens

__ standard tokens __ Anything from metalsmith-interpolate is available, check that package for details but for quick reference:

  • path tokens like: root, dir, name, base, ext
  • meta tokens like: title, author, or anything else in your front matter
  • date tokens like: {YY/MM/DD} (any moment format)
  • put a - or _ infront of the token to slugify like {-title}

__ relative path __ This package provides a {relative} token, as shown in the example above this token provides the relative path from the specified src directory. This token is only available where src specifies a directory as shown in the examples above.

options

There's not really any options :-/

Author

Levi Wheatcroft levi@wht.cr

Contributing

Contributions welcome; Please submit all pull requests against the master branch.

License

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    6
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    6

Package Sidebar

Install

npm i metalsmith-move

Weekly Downloads

6

Version

1.0.0

License

MIT

Last publish

Collaborators

  • leviwheatcroft