---
title: "Adding last modified timestamps to content"
date: 2021-02-15
description: "Programmatic ways of adding timestamps Git History plugin GitHub button to see file in GitHub Time to add this timestamp..."
canonical_url: https://idratherbewriting.com/blog/adding-last-modified-timestamps-to-documentation/
---
# Adding last modified timestamps to content
However, programmatically adding the last-modified timestamp to the page based on the actual last commit in Git isn’t a great idea. Sometimes I update pages to change some metadata in the frontmatter (the page’s weight value that determines page order). Other times I might update the ad tags on the page. Other times I fix a broken link. If the content isn’t reviewed, revised, or edited, but the last-modified timestamp gives readers the impression that it was recently updated, then this small change to the page distorts the value of the last-modified timestamp.

What readers expect when viewing the last-modified tag is the date when the content was last edited in some marginally significant way. Because there’s no way to retrieve this date programmatically, I manually added a `last-modified` property to the frontmatter and then manually populated this field with a time value following `yyyy-mm-dd` format (so that the date format can be manipulated by date filters).

## Git History plugin

Although I could use `git log` to check commit history for a file, I found it easier to use a more visual GitHub plugin called [Git History](https://github.com/pomber/git-history). You can use this plugin in a couple of ways.

You can browse to the file in GitHub. You’ll then see a new button that says “Open in Git History”:

![Open in Git History](https://s3.us-west-1.wasabisys.com/idbwmedia.com/images/githistoryscreenshot2.png)

Clicking Open in Git History opens the file in a view like this:

![Browser view of Git history](https://s3.us-west-1.wasabisys.com/idbwmedia.com/images/githistoryscreenshot3.png)

You can also just go to the file in GitHub and then replace `github.com` with `github.githistory.xyz` in the address bar. This way, you can just update the URL with each page permalink rather than going into the GitHub GUI each time. Either way opens up the same history view.

In the history view, the changed text appears in a bold white font while the unchanged appears more off-white. Looking at the above screenshot, I see that on Jan 18, 2021, I added a `last-modified` property to the frontmatter. If I were to programmatically print the last-modified timestamp to the page, it would select Jan 18, 2021. However, this edit was trivial and unrelated to the content itself.

You can see different commit histories by selecting a different timestamp at the top. I moved further back along the timeline until I could see changes to the actual content of the page. Back on Aug 4, 2020, I changed the page title. The same date I also added the original page as well.

![Browser view of Git history](https://s3.us-west-1.wasabisys.com/idbwmedia.com/images/githistoryscreenshot1.png)

So for my `last-modified` timestamp, I chose `2020-08-04`. Unfortunately, when I update the page again, I’ll need to manually remember to update this date. But at least now I have a baseline of real last modified dates.