Skip to content

drffej/eleventy-plugin-contributors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git Contributors for Eleventy

A git contributors plugin for Eleventy static site generator. The plugin returns a array of Git contributors for a page.

Install the Plugin

Install in project directory by running:

npm install --savedev eleventy-plugin-contributors

In your Eleventy config file (defaults to .eleventy.js) include the plugin :

const getContributors = require('eleventy-plugin-contributors');

module.exports = function(eleventyConfig) {
    eleventyConfig.addPlugin(getContributors);
}

Configuration Options

The contributorplugin can be customised via the following options:

const getContributors = require('eleventy-plugin-contributors');

module.exports = function(eleventyConfig) {
    eleventyConfig.addPlugin(contributors, {
        commits: 200, // the maxmium number of commits to include
        repo: __dirname // location of the repo
    });
}

Using the Plugin

Now you can use the getContributors filter in your templates, to return an array of contributor records for a given file containing the git settings for authorName and authorEmail.

For example the following Nujucks markup will list the contributors for the current page:

{% set contributions = page.inputPath | getContributors -%}

{% for contributor in contributions -%}
-   {{contributor.authorName}} {{ contributor.authorEmail}}
{% endfor %}

License

MIT.

About

Eleventy plug to return list of Git contributors for a page.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors