25 Days of omg.lol

Day 7

Today we bring a smattering of weblog.lol updates all centered around navigating your weblog. Yay!

First things first, though: as this little baby weblog service continues to grow before our collective eyes, I think it’s important to pause for a moment and review some terminology. Given today’s updates, this will hopefully be helpful. (And without a solid understanding of the points below, things might become confusing.)

So far we’ve talked about paths and slugs. Now let’s talk about locations.

First, a diagram:

           |                     |               |
        address                 path            slug

The key points here:

The last term, location, is new. And with today’s update, you can now specify a location in your post metadata if you’d like. The location is the end-all-be-all of accessing something on your weblog. If a location has been specified, paths and slugs become irrelevant: the location takes precedence, and it defines how the post/page will be accessed.

These are all examples of valid location metadata:

In all three of the examples above, the post/page would be accessible at that exact location. Doesn’t matter if a slug is set, doesn’t matter if a path is set.

Got it? Awesome. Because you’re going to need to remember locations for this next thing.

Weblog Navigation

Today’s update brings another fun new feature: the {navigation} tag! To use it, you’ll first want to configure your navigation by setting it up in your configuration file, like this:

Navigation: about, favorites, thoughts/random

The format here is a comma-separated list of page locations. See, I told you that locations would be important! You’re not specifying the slugs or titles here (though those may actually match the location; it just depends on your setup); you’re specifying the actual location where the post or page can be accessed.

With that established, you can drop {navigation} in your page template, and you’ll get a nice semantic <nav> element with a list of your specified pages (including the page titles, which is nice because if you rename those pages your nav will update automatically as well). You can style this however you’d like, but I’ll soon have an updated template available that shows how to do this.

Two notes about navigation:

  1. For the time being, the navigation is “dumb” in that it’s not aware of the pages that visitors are accessing. This is in contrast to the recent post list, which has that awareness (when you’re visiting a specific post, that post isn’t a hyperlink in the recent posts list because it’s the active page). Anyway, don’t worry, this same treatment will be applied to the navigation soon.
  2. This approach to navigation isn’t for everyone. If you find it useful, great! But you may be equally happy to manage your navigation directly in your template file, which is totally cool as well.

Landing Page

One more new feature today, which is the ability to specify a landing page. Previously, your weblog would default to the post recent post. That doesn’t work for everyone, so now you can specify a landing page if you’d like. (If you don’t, the previous behavior will continue to apply.)

To set your landing page, just add this to your configuration:

Landing page: my-awesome-landing-page

And yeah, you guessed it—the my-awesome-landing-page is a location. Make sure it’s valid, because I didn’t have time to add any kind of validation for this and I don’t know what happens if you put an invalid location there. (Not even joking — I don’t even have time to proofread this post because I’m four minutes away from going to hang out with my kids and play some video games.)

Other updates

That’s all for now! Thanks, as always, for enduring the quirks and glitches with the weblog. See you again tomorrow, behind yet another door.