I’ve been trying to get to grips with the Middleman blog extension and have come up with the idea of using it to split posts into either journal entries or full blown tutorials/essays.
I have two templates set up with the following code to check if a blog post has the ‘essay’ tag and either display it in the /essays page or the /journal page.
The logic looks like this for the essay page:
- page_articles.select { |a| a.tags.include? 'essay' }.each_with_index do |article, i|
and this for the journal:
- page_articles.each_with_index do |article, i|
- unless article.tags.include?("essay")
The problem is is that this messes with pagination. The pagination is calculated based on the total number of posts, even if they aren’t included in the page. This is ending up with me having the essays section listing maybe one thing before it generates pagination to go on.
I’m pretty much a ruby neophyte, so I haven’t managed to work out a way of making pagination work happily with this splitting of entries.
Is there some way I can stop having irregular amounts of posts on their respective pages or is this just me trying to push the blogging extension too far?