Skip to content
Dead simple plugin to return the last modified date of a file. Useful to build a better sitemap.xml :)
Ruby
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
jekyll-last-modified.rb

README.md

jekyll-last-modified

Dead simple Jekyll plugin to return the last modified date of a file. Useful to build a better sitemap.xml :)

Installation

Copy jekyll-last-modified.rb into the /_plugins/ directory of your Jekyll project.

Usage

Basic Example

The plugin adds a new custom liquid tag, which can be used as follows:
{% last_modified /myfile/index.html %}

You can also use liquid objects within the tag:
{% last_modified {{ post.path }} %}

Production Example

I’m using the plugin on My Morning Routine to use the last modified date for <lastmod> in our sitemap.xml:

<lastmod>{% capture lastmod_date %}{% last_modified {{ post.path }} %}{% endcapture %}{{ lastmod_date | date_to_xmlschema }}</lastmod>

Credits

You can’t perform that action at this time.