25 Days of omg.lol

Day 18

Finally, some more progress on weblog.lol! It’s not the two larger features that I’ve been hinting at over the past couple of days, but something else that I think is just as cool.

This new thing also introduces some changes to existing stuff, so if you’re living on the bleeding edge as a pre-pre-alpha weblog.lol user, you’ll want to know about this!

More powerful configuration

Today, our configuration engine evolved a bit further. It’s a challenge to balance greater power and flexibility against the need to keep things simple, but I’m doing the best that I can. Having said that, I’m open to feedback on everything here if you want to share any.

So, the new thing today is templatable configuration items. That’s not a great label (I don’t even think that “templatable” is a real word), but let’s run with it for now.

Here’s an example of it in action, with another new thing:

Recent posts format

Starting today, instead of being forced to use the specific markup that weblog.lol generates for {recent-posts}, you now have the ability to fully customize that markup. So powerful!

Here’s the configuration for that:

Recent posts format: <<[
[post:begin]<li><a href="$location">$title</a></li>[post:end]

So, let’s take a look at what’s going on here:

  1. First, a quick reminder: the multi-line thing you’re seeing here, which starts with <<[ and ends with ]>>, is a throwback to day eight, where this was first introduced.
  2. It’s a typical unordered list, starting with <ul> and ending with </ul>.
  3. Now, the cool part: the list items are wrapped in special “bumper“ tags: [post:begin] and [post:end]. Whatever is between these bumpers will be repeated for each post when preparing the recent post output.
  4. There are two configuration variables here, $location and $title. They’ll output the post location and title, respectively.

The example configuration shown above happens to be the default, so if you don’t include this in your own configuration, this is how your {recent-posts} will render. It matches exactly what weblog.lol has been doing all along with the recent posts output, so there’s really no change overall.

But let’s say you want to show the date for these posts? Easy:

Recent posts format: <<[
[post:begin]<li><a href="$location">$title</a> $date</li>[post:end]

Here, you can see that the $date variable is shown next to the post link. This will display the post’s date using the same date format that’s specified in your configuration.

Also new today is a $relative_date variable, so you can get output like “six months ago” instead of the specific date/time.

So, that’s everything about this feature. It’s new and experimental, so you know the drill: let me know if there are any issues.

Recent posts count and post list

Today I’ve also made a change that makes {recent-posts} live up to its name. There’s a new Recent posts count configuration item, which by default looks like this:

Recent posts count: 5

Which means that wherever you had {recent-posts} before, you’ll now see five posts instead of all of them. You can set the value to whatever number you’d like in your configuration.

Right alongside this change comes a new {post-list} tag, which does what {recent-posts} used to do—it renders a complete list of all of your posts. This is perfect for a post archive page.

{post-list} can also be configured with a Post list format configuration item, which makes use of the same templatable configuration item feature introduced above. So you can make your post list show the date, use other markup, or do pretty much whatever you’d like.

Phew, long post today. Thanks again for joining me on this 25 day journey of fun, and I’ll see you tomorrow with (hopefully) more awesome stuff to share.

— Adam