Skip to content

Instantly share code, notes, and snippets.

@taxigy
Created January 5, 2020 19:42
Show Gist options
  • Save taxigy/6d3b373ff338d7c7cf6af9b37dacd824 to your computer and use it in GitHub Desktop.
Save taxigy/6d3b373ff338d7c7cf6af9b37dacd824 to your computer and use it in GitHub Desktop.
A Git pre-commit hook for Jekyll to add site update date per commit
#!/bin/sh
# Add current date to the "updated" property in _config.yml
# e.g.,
# updated: 2020-01-01T00:00:00.000Z
export CURRENT_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
sed 's/updated:.*$/updated: '${CURRENT_DATE}'/' _config.yml > _config.yml2
mv _config.yml2 _config.yml
git add _config.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment