Skip to main content

Digitally Adrift

Change Server Time

I created a new script that wraps hugo new to create shorter, untitled posts. It uses the date function to set values for directories, filename and post title. By default it was using UTC so any post I made in the evening, ending up in the next day.

After a bit of searching I found it’s incredibly easy to change the timezone that is used for this. The timezone is pulled from a file /etc/localtime which can be symlinked to a value in /usr/share/zoneinfo. So I was able to do a simple ln -s /usr/share/zoneinfo/US/Eastern /etc/localtime and now my timestamps are working as expected.

The base Hugo configuration file also allows for a timezone parameter to be set, so I updated that to my timezone and Hugo generated dates are now in my timezone.

Easy peasy.