Skip to content

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

License

Notifications You must be signed in to change notification settings

AaronDovTurkel/metalsmith-path-metadata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  1. Installation
  2. Use

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; 
  });

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published