Page: changelog
Entries: 3
Page: changelog
Entries: 3
I ran into a fun problem this week. I moved my Eleventy source files to a different computer and realized that because my post dates are being read from the “date created” metadata of the files in finder, when the website files are copied, all the post display dates reset to the copied date as well, instead of retaining their original created date. I’m now realizing why they recommend NOT using “date created” in the Eleventy docs :)...
There is a way to override the date by manually typing a fixed timestamp in the markdown front matter. I’m annoyed by this because I want to be able to post nearly blank markdown files. In fact, many of my entries didn’t even have front matter previous to this discovery.
I put a lot of effort into reducing the steps to publishing, so I will not tolerate having to type out “date: 2025-03-12T16:43-04:00” every time I want to make a new post. Since I do already have my mkpost() bash script to create an index.md inside a new folder named with the current timestamp, I figured there must be a way to write the date to the contents of the markdown file at the same time as well.
I updated my script to look like this:
mkpost() {
export STAMP=$(date +%Y-%m-%dT%H:%M-05:00)
export POSTDIR=src/posts/$(date +%Y-%m-%d-%H-%M)
mkdir -p $POSTDIR
echo -e "---\ndate: $STAMP\n---" >> $POSTDIR/index.md
}
Great! Except not, because now the hour displayed on the website is different from the hour in the folder name and permalink. I really wanted to tear my hair out because I couldn’t believe how complicated this function had to be in the end. I went from a 1-liner to 12! All to accommodate daylight savings time. In a way I was lucky that this happened across the week where we sprung forward. Otherwise I never would have thought about a variable UTC offset.
I’m pleased to present my new mkpost() script which will automatically account for the clocks changing twice a year:
mkpost() {
export DST=$(date +%Z)
if [ $DST = 'EDT' ]; then
export OFFSET='04:00'
else
export OFFSET='05:00'
fi
export STAMP=$(date +%Y-%m-%dT%H:%M-$OFFSET)
export POSTDIR=src/posts/$(date +%Y-%m-%d-%H-%M)
mkdir -p $POSTDIR
echo -e "---\ndate: $STAMP\n---" >> $POSTDIR/index.md
}
Wasn’t this a thrilling entry??
I always intended to make a decision about organization once I hit 10 posts. I made some big changes to the website structure today to accommodate new ways of manipulating the post library.
What is new:
Only seven posts now show on the home page. I chose the number seven because there are seven days in a week. If I post every day, one week's worth of posts will appear.
The eighth post and beyond appear in a list at the end of the home page. People who want to read every post can click into each entry individually.
Each post is now stamped with the date and the time. I know this is insane, but it's so I can post multiple times per day (like today).
I've written a bash script to automatically create a new folder in my posts folder that is given the current date and time as its title. The script also creates an index.md file inside this new folder at the same time. This ensures that my permalink matches the "date created" data in the post. The script looks like this:
mkpost() { mkdir -p -- src/posts/$(date %Y-%m-%d-%H-%M) && touch -- $_/index.md }
I created tag pages so that I can begin to make collections of useful topics. At the moment I'm only using "about", "changelog", and "my-work". This post is included in changelog and can be demonstrated here.
Hope to stop blogging about my blog itself for a little while now :)
I moved my hosting from Github Pages to NearlyFreeSpeech.net. Even though Github’s service is free, it felt counter to the spirit of my project to work with a company owned by Microsoft. I like the ethos of Nearly Free Speech and their frumpy text-based web presence. My files are living here for $0.02 per day.
Speaking of text-based, I’m feeling very excited about command-line interfaces now that I’ve spent some time uploading and downloading via SSH. Historically, operating in the terminal has been really intimidating for me but this experience setting up my new server space has helped unlock a new confidence and understanding. I am grateful to Michael for confirming that “it’s just files,” and for sparking the idea for the script which publishes the page you are reading now. I’m seeing computers in a new light. Many programs really are just writing files and moving them around. The art of text files and their arrangement is my new obsession.
I’ll leave my first post intact in case anyone would still like to use the resources listed there as a guide for deploying Eleventy with Github Pages. From here, I will now be publishing with the command “npm run woo”, in which “woo” equals:
npx @11ty/eleventy && rsync -zavP --delete /my/local/path/ my_account@my.host.net:/my/remote/path
(saved in the scripts section of my package.json file). This runs the Eleventy build command and, when successful, synchronizes the contents of the _site output folder with the public location on my server. I chose to name it woo because I was excited and “woo” is how I feel every time I post.
Lastly, I wrote a draft of this post on my Supernote as a txt file and then copied it into the Pico editor in my terminal application. I decided if I’m earnest about disengaging from Microsoft, I probably shouldn’t use VS Code to write my blog entries either. Next for me is learning Doom Emacs.
woo!