Pelican is a great site generator. Very fast, very stable and with just enough features to allow its daily usage. But I was lazy enough to let it use the filesystem date to keep track of when I published an article.
This worked just fine for many years, until one day I decided to change my legal name. Without any hesitation I just ran a script and changed all the articles. Sadly, this screwed up the timestamps on all of the blog posts I ever published!
In order to fix it I had to first update Pelican to its latest version (the ole one used ctime
which you do not want to be manually changing at all). And then use a simple script to reset the file dates to something meaningful.
Luckily I used git to keep track of my artcles, so that I could reset the time of the files to the time of their first commit with a simple bash script like this:
$ cat ~/date-reset.sh
#!/bin/bash
DATE=$(git log --diff-filter=A --follow \
--format=%ad -1 --date=format:'%Y%m%d%H%M.%S' -- $1)
touch -a -m -t $DATE $1
$ find . -type f -exec ~/date-reset.sh {} \;
There are probably other changes to my small blog due to the site generator engine update. Sorry.