eleventy-plugin-git-commit-date

    0.1.3 • Public • Published

    eleventy-plugin-git-commit-date

    This Eleventy plugin provides two template filters:

    1. getGitCommitDateFromPath: Gets Git commit date from path. E.g. {{ page.inputPath | getGitCommitDateFromPath }}.
    2. getCollectionNewestGitCommitDate: Get Git commit date of the newest committed file from a collection. E.g. {{ collections.all | getCollectionNewestGitCommitDate }}.

    🌏 This plugin is made primarily to populate <updated> fields in an RSS feed. Here is a blog post on how to use this plugin with eleventy-plugin-rss.

    ⚠️ Getting Git commit date is a bit slow (~50ms for each path). So, use it sparingly. It's recommended to call this filter within a production flag.

    Usage

    1. Install

    npm install eleventy-plugin-git-commit-date

    2. Add to Eleventy config

    // .eleventy.js
    
    const pluginGitCommitDate = require("eleventy-plugin-git-commit-date");
    
    module.exports = function (eleventyConfig) {
      eleventyConfig.addPlugin(pluginGitCommitDate);
    };

    3. Use in templates

    Using {{ page.inputPath | getGitCommitDateFromPath }} will display the git commit date of the file using a local time zone like:
    
    Sun Dec 31 2017 18:00:00 GMT-0600 (Central Standard Time)
    
    Using {{ collections.all | getCollectionNewestGitCommitDate }} will display the git commit date of newest file in the collection using a local time zone like:
    
    Sun Dec 31 2017 18:00:00 GMT-0600 (Central Standard Time)

    Credits

    Install

    npm i eleventy-plugin-git-commit-date

    DownloadsWeekly Downloads

    0

    Version

    0.1.3

    License

    MIT

    Unpacked Size

    6.49 kB

    Total Files

    6

    Last publish

    Collaborators

    • saneef