An open API service indexing awesome lists of open source software.

https://github.com/arve0/metalsmith-frontmatter

metalsmith plugin: set YAML front-matter to global metadata
https://github.com/arve0/metalsmith-frontmatter

Last synced: 3 months ago
JSON representation

metalsmith plugin: set YAML front-matter to global metadata

Awesome Lists containing this project

README

        

# metalsmith-frontmatter

Sets front-matter of files to the global name `frontmatter`. For use with
[metalsmith-changed](https://github.com/arve0/metalsmith-changed). Lets one
access front-matter of files, even if they should not build.

Example:
```
var Metalsmith = require('metalsmith');
var frontmatter = require(metalsmith-frontmatter');
var changed = require('metalsmith-changed');

var metalsmith = Metalsmith(__dirname)
.clean(false)
.use(frontmatter)
.use(changed())
... // more plugins
.build(function(err){
if (err) throw err;
});
```

In your template:
```

Some header

{{frontmatter['path/to/file.md'].title}}


```

**Note:** `contents`, `next` and `previous` properties are not saved to
`frontmatter[file]`.