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
- Host: GitHub
- URL: https://github.com/arve0/metalsmith-frontmatter
- Owner: arve0
- Created: 2015-07-15T00:50:08.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-07-15T19:53:14.000Z (almost 10 years ago)
- Last Synced: 2025-02-12T19:19:36.903Z (3 months ago)
- Language: JavaScript
- Size: 113 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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]`.