Posts tagged ‘Hugo’

It’s been bugging me for a while that Vercel is generating incorrect “last modified” datetimes for my wiki pages on this site. What it seems to be doing is getting the last modified date only if it’s within the ten most recent commits. If the last modification was further back than that, it prints the last modified datetime of the tenth-most recent commit. From the docs(external link) it looks like Vercel is not even fetching git commit author dates (but commit SHAs and commit author logins, those it fetches…), so instead I guess it stores some cache that only goes back ten commits? I have no real clue, but because I don’t know how to fix this, I’ve commented out the part of my template that generated “last modified” text for my wiki pages. Better to display nothing than to have it display something that’s wrong for the vast majority of pages…

I mean… one way to fix this would be to build my site using GitLab’s CI/CD and just upload the built files to Vercel, instead of GitLab merely passing the source files along for Vercel to build. But ugh, what a hassle to change that all around 😩 Another strategy would be to manually set a “last modified” date in the front matter of pages I want to have one, and display that in preference to whatever git says. (Or even disable enableGitInfo entirely, if it’s just resulting in junk data.) That’d also be annoying, though. So, for the moment, I think just not displaying “last modified” dates’ll have to be the go.

Uhh, well here’s a little Vercel quirk to be aware of: its default build command for Hugo repositories builds all your drafts as if they were ready-to-go finished posts 🤯 It’s not like I had a burn book stashed away in my Hugo drafts or anything but it’s definitely something I wish I’d noticed yesterday! TBH it’s so random it hadn’t even occurred to me they could possibly be doing that – the “build drafts” flag -D is something you have to explicitly add to the basic hugo build command, after all. Fixed now, anyway.

I’ve run into more obstacles than I thought I would, but not only do I have an Indiekit Micropub endpoint up and running now (but not working for media uploads yet), but I’ve also set up continuous deployment with Github Actions, so my static Hugo site rebuilds after every new post. This guide here(external link) was really helpful for the Github Actions stuff, and the only reason I lost three hours of my life afterwards is that I missed the really critical information that it’s written assuming you haven’t set a custom value for publishdir in your Hugo config file. Whoops.

Anyway, I have more tinkering I want to do, but I’ve been staying up late night after night and it’s time I treat myself to getting into bed before midnight. My site will still be there to tinker on tomorrow, after all…

It’s been outwardly really quiet on this blog in the last few days, and that’s because I’ve been hard at work setting up Indiekit(external link) so I can post to here via Micropub (after my first attempt proved I am not good enough at programming to assemble an implementation by myself, even with loads of references 😂).

Once I’ve actually finished I might write up a longer post explaining how it’s all gone (because I’m sure it’ll be enthralling reading!). One thing I am really proud to have accomplished, though, is forking Indiekit’s Hugo preset and modifying it to generate my custom year and month metadata that I use to generate archives. Considering I’ve never written Javascript before, this was a huuuuge achievement for me. I still have a fair whack of stuff on my wishlist to work through, but the more successes I have the more confident I feel that I can get this working exactly how I want it 💪

a cartoony avatar of Jessica Smith is a left-wing feminist who loves animals, books, gaming, and cooking; she’s also very interested in linguistics, history, technology and society.