GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - saneef/eleventy-plugin-git-commit-date: Eleventy plugin to get recent Git commit time of a file, or a Eleventy collection.

BranchesTags
Open more actions menu

Latest commit

 

History

48 Commits
48 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
src
src
 
 
tests
tests
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.npmignore
.npmignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
ava.config.js
ava.config.js
 
 
eslint.config.js
eslint.config.js
 
 
index.js
index.js
 
 
lefthook.yml
lefthook.yml
 
 
package.json
package.json
 
 
pnpm-lock.yaml
pnpm-lock.yaml
 
 
prettier.config.js
prettier.config.js
 
 

Repository files navigation

eleventy-plugin-git-commit-date

This Eleventy plugin provides two template filters:

Filter Description
getGitCommitDateFromPath Gets Git commit date from path.

Usage: {{ page.inputPath | getGitCommitDateFromPath }}
getCollectionNewestGitCommitDate Get Git commit date of the newest committed file from a collection.

Usage: {{ 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.

Usage

1. Install

npm install eleventy-plugin-git-commit-date

2. Add to Eleventy config

// eleventy.config.js

import pluginGitCommitDate from "eleventy-plugin-git-commit-date";

export default 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)

FAQs

When used with GitHub Pages, why are the last commit dates incorrect?

Only the last commit is checked out by GitHub Action Checkout by default. The commit dates for files changed in the previous commits will not be available. You can set the fetch-depth as 0 to get all the history from the Git repository.

   - name: Checkout
     uses: actions/checkout@v3
+    with:
+      fetch-depth: 0

Credits

  • @zachleat suggested the use of Git commit dates instead of modified date.
  • The core code is based on Jens Oliver Meiert' blog post Eleventy: How to Work Around the “git Last Modified” Performance Bottleneck.
  • Pre v1.0 was based on @vuepress/plugin-last-updated.

About

Eleventy plugin to get recent Git commit time of a file, or a Eleventy collection.

Topics

11ty11ty-plugindateeleventyeleventy-plugingitgit-commit

Resources

Readme
MIT license
Activity

Stars

12 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.