Day 14
Wow, time is flying. Can you believe that after today, there are only 11 more days of the 25 Days of omg.lol?
Today I was able to finish the optimizations that I mentioned yesterday. But I also broke a bunch of stuff! But I also fixed most of it, and made a lot of it better. If you notice anything weird with your weblog, please let me know.
So, what’s new? Let’s dive in:
New API endpoints
There are two brand new API endpoints today:
- POST /address/:address/weblog/template
- POST /address/:address/weblog/configuration
They do pretty much exactly what you’d imagine, which is updating your template and configuration. Both accept a raw text payload (not JSON) equivalent to what you see in the weblog editor when managing your template or configuration in the web UI.
Both of these were needed to make the next new thing work, which is..
Updated GitHub Action functionality
On Day 12 we introduced the new GitHub Action that lets you manage your weblog content through a GitHub repo (it also happens to be an excellent way to import a bunch of posts, though it’s not quite ready to be considered a robust import tool yet). You may recall that part of the process involved creating a weblog
directory in the root of the repository, and storing your posts there. Well, as of now, you can also create another folder alongside that one in the root called configuration
, and in there you can store these two files:
-
template.html
, your weblog template -
configuration.txt
, your weblog configuration
And if you make changes to these files, the GitHub Action will pick them up and ensure that your weblog is updated with the latest configuration and template stuff. It works really well!
Also, one of the “three rules” mentioned on Day 12 has already changed (for the better): previously, you couldn’t store any posts or pages directly within the weblog
directory in your repo; everything had to be stored within some other directory in there. Now you can put them anywhere within the weblog
directory, including in the root. Yay!
⚠️ Important note: In order to fully complete some of the optimizations referenced above, there is a required change to the GitHub Action setup. All you need to do is update the main.yml
file that you previously created to set up the action with the latest version found here: https://github.com/neatnik/weblog.lol
So, with that, we have one final new thing. It’s a fun one:
Random Posts
Because of the restructuring done as part of the recent optimization work, it’s now possible to add a fun little random post option. To use it, just add this to your configuration:
Random post location: /random-post
(you can edit the path value to whatever you’d like)
Once you’ve saved that, visit your random post location on your weblog (e.g. foobar.weblog.lol/random-post) and a random post will appear! And because it’s rendered right then and there, with no browser redirection, you can just refresh the page to load another random post. Wheeee!
So. That’s all for now. Have a wonderful day, and let me know if you run into any glitches anywhere. More fun stuff tomorrow—see you then!
— Adam