25 Days of omg.lol

Day 8

A few days ago (on Day 3, to be exact) we introduced weblog.lol’s configuration stuff. Today, we’re expanding upon it in a couple of ways!

Here’s what’s new:

Configuration defaults

Until now, the default configuration file was a “default” in the sense that it was what a brand new weblog was equipped with when it was set up for the first time. Now, it’s also the actual default collection of settings for every weblog. This means that if you remove an item from your own configuration file, your weblog will inherit the default from the canonical configuration file (linked just above).

Why? Because without certain configuration items in place, your weblog will break. And that’s not cool! So, falling back to the default values for anything that’s not explicitly specified in your own configuration file will prevent that from happening.

There’s also a new trick up the configuration’s sleeve, which is...

Multi-line configuration items

Most configuration items are a simple one-line key-value pair. Key: Value. Easy stuff, simple, works well. But what if you want something a little more sophisticated? Like something that might take a little bit of extra vertical space.

There’s a new configuration syntax that will let you work with configuration items that span multiple lines. It looks like this:

Configuration item: <<[Line 1
Line 2
Line 3]>>

To use it, just be sure that the very first part of your configuration item’s value is <<[ and the very last part is ]>>.

When would you want to use this? Well, it just so happens that we’re also adding a new configuration item that makes use of it...

Default posts

When you create a new weblog post, you get a default post that looks like this:

Date: 2022-12-08 17:42

# Your new post

This is a new blog post. You can author it in _Markdown_, which is **awesome**.

There wasn’t any significant thought that went into this default—I just thought that it would be good to show the metadata (and indicate that your post date/time is set there) and also demonstrate that you can author a post in Markdown. (By the way, did you know you can also author your posts in pure HTML? Or a mix or HTML and Markdown? Well, you can!)

So the default post content is “fine, or whatever” but maybe you want your own default. Which you should totally be able to have! And as of now, you can. Just add something like this to your configuration:

Default post: <<[Date: $date

# Diary Entry No. ___

Dear Diary,

Today I...]>>

You can make your default post consist of whatever you’d like. This can be especially useful if your posts tend to follow a certain structure, or if you want to include some consistent chunks of text (throw them in there!) or even templatize your posts.

Also note that in this example, I didn’t put the --- above and below the post metadata. That’s because it’s optional! So, keep that in mind as well if you’re not a fan of that visual separator for metadata.

The only other thing to note here is that $date is a placeholder for the actual date/timestamp, so be sure to keep that there to make your life a little easier in your default posts.

Other updates

That’s all for now! If you run into any trouble, feel free to ping me on Mastodon, IRC, via email, or on GitHub. See you again tomorrow, behind yet another door.