Skip to content

Latest commit

 

History

History
62 lines (48 loc) · 1.63 KB

README.org

File metadata and controls

62 lines (48 loc) · 1.63 KB

Metalsmith Path Metadata

A plugin for Metalsmith that modifies metadata for a given path.

If you need some help, send me an email!

Table of contents

Installation

Go to your working directory then:

$ npm install metalsmith-path-metadata

Use

var Metalsmith   = require('metalsmith');
var collections  = require('metalsmith-collections');
var layouts      = require('metalsmith-layouts');
var markdown     = require('metalsmith-markdown');
var permalinks   = require('metalsmith-permalinks');
var pathMetadata = require('metalsmith-path-metadata'); // Import/require the file 

Metalsmith(__dirname)         
                              
  .metadata({                 
                              
    sitename: "My Static Site & Blog",
    siteurl: "http://example.com/",
    description: "It's about saying »Hello« to the world.",
    generatorname: "Metalsmith",
    generatorurl: "http://metalsmith.io/"
  })
  .source('./src')       
  .destination('./build')
  .clean(true)          
  .use(collections({    
    posts: 'posts/*.md' 
  }))                   
  .use(pathMetadata({                     // Use the plugin and pass in config
    "about.hbs": {                        // Specify the path 
      title: "New Title For This Example" // Specify the key with the new data
    }
  }))
  .use(markdown())      
  .use(permalinks({     
    relative: false     
  }))
  .use(layouts())       
  .build(function(err) {
    if (err) throw err; 
  });