Skip to content

frnd/metalsmith-imagecover

Repository files navigation

Build Status

metalsmith-imagecover

A Metalsmith plugin to assign each page with an image cover.

Installation

$ npm install metalsmith-imagecover

CLI Usage

Install via npm and then add the metalsmith-imagecover key to your metalsmith.json plugin, like so:

{
  "plugins": {
    "metalsmith-imagecover": true
  }
}

Javascript Usage

var imagecover = require('metalsmith-imagecover');

metalsmith.use(imagecover());

Options

{
  "property": "cover",
  "attributes": ["src", "alt", "title"]
}

property: is the name of the property that this plugin will create in metadata. attributes: the list of attributes to extract

How to use in your template

Place in your template something like:

{% if post.cover %}
<img src="{{post.cover.src}}" alt="{{post.cover.alt}}" title="{{post.cover.src}}"/>
{% endif %}

License

MIT

About

A metalsmith plugin to assign each page with an image cover.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published