update lastmod git-hook

This commit is contained in:
Dominic Reich 2023-04-10 09:55:29 +02:00
parent 84b05ec230
commit fb6d0d41a5
Signed by: dominic
GPG key ID: BC9D6AE1A3BE169A
2 changed files with 3 additions and 3 deletions

View file

@ -3,8 +3,8 @@
# Replace `last_modified_at` timestamp with current time
# https://mademistakes.com/notes/adding-last-modified-timestamps-with-git/
git diff --cached --name-status | egrep -i "^(A|M).*\.(md)$" | while read a b; do
cat $b | sed "/---.*/,/---.*/s/^lastmod =.*$/lastmod = \'$(date -u "+%Y-%m-%dT%H:%M:%S%z")\'/" > tmp
git diff --cached --name-status | grep -E -i "^(A|M).*\.(md)$" | while read a b; do
cat $b | sed "/+++.*/,/+++.*/s/^lastmod.*$/lastmod = '$(date -u "+%Y-%m-%dT%H:%M:%S%z")'/" > tmp
mv tmp $b
git add $b
done

View file

@ -2,7 +2,7 @@
title = "Links"
summary = """Listing links of (hopefully) useful websites"""
date = "2022-11-20T15:56:36+0100"
lastmod = '2023-04-10T09:25:37+0200'
lastmod = '2023-04-10T08:06:48+0000'
comment = false