1.0.0 • Published 7 years ago

metalsmith-medium-data v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Metalsmith Medium data

Metalsmith plugin to fetch latest user post data from medium.com as metadata for template usage.

Installation

$ npm install metalsmith-medium-data

Usage

Add an metalsmith-medium-data entry in metalsmith.json or pass the plugin to metalsmith.use() in a JavaScript file.

metalsmith.json

{
    "plugins": {
        "metalsmith-medium-data": {
            "username": "huntie"
        }
    }
}

JavaScript file

import medium from 'metalsmith-medium-data';

metalsmith.use(medium({
    username: 'huntie'
});

The plugin will add a new metadata object on build under the key medium for use in templates.

PropertyTypeDescription
medium.userObjectThe user profile data.
medium.postsArrayThe collection of most recent user posts.

Options

NameTypeRequiredDefaultDescription
usernameStringYesnullThe Medium account user from which to fetch posts.
keyStringNo"medium"The name of the key to set in metadata.
limitNumberNo10The maximum number of posts to include.

Contributing

If you discover a problem or have a feature request, please create an issue or feel free to fork this repository and make improvements.