Support for multiple locations in a post
Until now I have only been able to add a single location and a single list of birds to each post. This means that on a day where I visit multiple locations, I have two choices:
- make a string of blog posts, which is often more effort than I want, and fragments my record. Do I really want a whole blog post to say I saw a Little Owl on the way home from somewhere else? Furthermore, if I split things up like this I don’t get a total count for the day.
- use vague locations like ‘Lancashire and North Merseyside’. That’s not the way I want to do things, because it means I might describe the same location as ‘Sands Lake’, ‘Ainsdale Dunes’ or just ‘Ainsdale’, depending on where else I’ve been that day.
So I have made some changes to make it possible to specify multiple locations in the front-matter of a post, with a separate bird list for each.
The old YAML looked like this:
whereas the new version interprets an additional field, locations.
This more complex YAML is hard to type, so the old style is preserved for posts where only a single location is required. In fact, it’s OK to use both in a single post; all locations will be counted. ( post.data[‘location’] and post.data[‘birds’] become entries in post.data[‘locations’] during generation). This means it’s possible to add additional locations as an afterthought.
I’ve adapted something from the Octopress Rakefile to aid in generating new posts; it’s not ready for public view however.
Here’s some boilerplate that can be used as the basis for any workflow:
Any text editor that understands Markdown should allow easy continuation of the bird lists, and it’s easy to see which four lines need copypasting to add additional locations.
I’ve used this system in anger for the first time here