How to automatically update last_modified date field in Netlify CMS?

This is something that seems simple but I just can’t find the settings for it.

I currently have two datetime widgets for articles. One for the Originally Published date — and one for Last Modified.

Each time i update a post I need to manually change the last modified date, which unsurprisingly, is always the current date.

Is there a non-hacky way of having Netlify CMS do this for me?

Many thanks

Hi @ShadowfaxRodeo,

I can’t think of a Netlify CMS way to do this. But I think this should be possible with GitHub Actions.

Hi :wave:

I can think of 2 ways to handle last modified date:

  1. Do it in the build process instead of the CMS, based on file stats.
  2. Use the CMS preSave event to keep it in sync.
1 Like