Created
January 5, 2020 19:42
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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