Post ‘series’: when specific topics require multiple chronological posts


#1

Hi friends!

I’ve been finding myself hacking around a fairly common use case recently. Much in the same way that seasons of television shows consist of a linear chain of episodes, I often find that complicated blog topics sometimes expand into epic collections of publications surpassing partI, part II (electric boogaloo), part III, part IV, etc.

This hasn’t been a huge problem as we’ve been using serveral hacks on Https://hackersandslackers.com to denote these relationships, but the solution is far from pretty.

In general it would be nice to have in my opinion to know that I’ve actually landed on part 3 of 7 in a technical tutorial as opposed to losing context. Something this simple would open possibilities for series-based widgets; something we’ve only scratch the surface on to help others discover relevant content.

I realize there are likely bigger fish to fry, but I’m curious to hear thoughts from the community as well as potential workarounds (hidden tagging perhaps?)


#2

This particular use-case is one of the main drivers in the dynamic routing project so things like this should get easier in the future.

In the meantime, if you wanted to have a section at the top of a post that lists each post in the series and highlights the one you’re currently on you could do something like:

  1. give all posts in a series a single tag
    • series gets a “homepage” on the tag page (a specific template could be added with tag-{slug}.hbs if needed)
    • allows use of the {{#get}} helper to get all posts with that tag
  2. ensure the publish date of the posts maps to the chronological series
  3. add a custom post template to apply to the series’ posts (or add a condition to your post.hbs for the series tag)
    • add a section to the top/bottom of the custom-{series}.hbs template that uses the {{#get}} helper to fetch all of the posts with the series tag
    • use the {{#has id=../id}} helper inside the {{#get}} block to highlight the current post within the list of posts

If you didn’t want to list all of the posts you could use {{#get}}'s block params (docs) to get pagination data then do something like:

{{#get "posts" filter="slug:my-series" as posts pagination}}
    Post {{pagination.page}} of {{pagination.pages}} in <a href="/tag/my-series/">My Series</a>
{{/get}}

#3

That’s a damn good solve… this is why I love this community. God forbid I find myself thinking through my own problems now and then :slight_smile: