Skip to main content

yaml-update-last-modified-date

Automatically set the last modified date in YAML front matter of edited markdown files.

Quick start

  1. cd into a folder containing a git repository.
  2. git add a modified markdown (.md) file that has last_modified_at in its YAML front matter.
  3. Get this script: curl --location --remote-name https://raw.githubusercontent.com/proinsias/yaml-update-last-modified-date/main/yaml-update-last-modified-date
  4. Run the script: bash yaml-update-last-modified-date.

This script will:

  1. Look for markdown files that differ from the current HEAD,
  2. Check to see if they contain the specified last-modified-date variable (last_modified_at by default) in their YAML front matter, if present, and
  3. Update the value of that variable to the current Universal Time Coordinated (UTC) time.

See below for instructions on how to install this script as a local command or as a pre-commit git hook.

Table of Contents

Installation yaml-update-last-modified-date via homebrew

If necessary, first install homebrew!

Then:

brew install proinsias/yaml-update-last-modified-date/yaml-update-last-modified-date

Using yaml-update-last-modified-date with pre-commit

Add this to your .pre-commit-config.yaml:

- repo: https://github.com/proinsias/yaml-update-last-modified-date
  rev: '' # Use the sha / tag you want to point at
  hooks:
      - id: yaml-update-last-modified-date

Credits

Thanks to Michael Rose for the original script.

License

See LICENSE.

Updating the Table of Contents of this file

We use markdown-toc to automatically generate the table of contents for this file. You can update the TOC using:

# npm install --global markdown-toc

markdown-toc -i README.md

Release files for yaml-update-last-modified-date 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yaml-update-last-modified-date 1.1.1
File Size Uploaded
yaml_update_last_modified_date-1.1.1.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yaml-update-last-modified-date 1.1.1
File Interpreter ABI Platform
yaml_update_last_modified_date-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.6 kB

Release files / yaml_update_last_modified_date-1.1.1.tar.gz

Download URL yaml_update_last_modified_date-1.1.1.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
de264f8506933717649c17d6664c75c2a2ac4ee6ffb1d30df4866ef4e5206a45
BLAKE2b-256 checksum
How to use checksums
44dcedddd6aad0e5ab65daf635e9a0ae36df0c6174bfb8fe012b044f5d74224b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.2 Darwin/22.4.0

Release files / yaml_update_last_modified_date-1.1.1-py3-none-any.whl

Download URL yaml_update_last_modified_date-1.1.1-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a7def3e8bfe51fc91d9ed2f2bb31b31a1c93cbf2daced8b1710617c83c11f370
BLAKE2b-256 checksum
How to use checksums
34602b77db35fc98615599590cccf72d93d8337cb161af5821890e7fe974484f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.2 Darwin/22.4.0

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page