No release in over 3 years
Low commit activity in last 3 years
A liquid tag for Jekyll to indicate the last time a file was modified.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 3.7, < 5.0
~> 0.3.9
 Project Readme

Last Modified Date Plugin

A liquid tag for Jekyll to indicate the last time a file was modified.

This plugin determines a page's last modified date by checking the last Git commit date of source files. In the event Git is not available, the file's mtime is used.

Setting up

Open your Gemfile in your Jekyll root folder and add the following:

group :jekyll_plugins do
  gem "jekyll-last-modified-date"
end

Add the following to your site's _config.yml file

plugins:
  - jekyll-last-modified-date

# Optional. The default date format, used if none is specified in the tag.
last-modified-date:
    date-format: '%d-%b-%y'

Usage

There are a few ways to use this gem.

You can place the following tag somewhere within your layout:

{% last_modified_date %}

By default, this creates a time format matching "%d-%b-%y" (like "04-Jan-14").

You can also choose to pass along your own time format. For example:

{% last_modified_date %Y:%B:%A:%d:%S:%R %}

That produces "2014:January:Saturday:04."

You can also call the method directly on a Jekyll "object," like so:

{{ page.last_modified_date }}

To format such a time, you'll need to rely on Liquid's date filter:

{{ page.last_modified_date | date: '%Y:%B:%A:%d:%S:%R' }}

(It's generally more performant to use the page.last_modified_date version of this plugin.)