Making a blog series, how to add a "posts in series" link list into a post based on metadata?

47 views
Skip to first unread message

jjhe...@gmail.com

unread,
May 22, 2018, 4:20:50 AM5/22/18
to hakyll
I'm making a series of blog posts on the same topic, and I'd like each post in the series to a full list of all posts in that series.

I thought about specifying this like this:

in post:

----
title: ...
series: series-name-1
----

Then either in my post markdown or in my post.html template, I'd somehow insert a list of all the blog posts that contain series-name-1.  Something like $series_links("series-name-1")$ or alternatively, the list generation would look at the posts series tags (if set) and filter the list automatically.

I realize this is a little bit like tags.  I tried to adapt something like https://stackoverflow.com/questions/35645525/hakyll-says-dependency-cycle-detected/35651294#35651294 to get a list of posts when I'm rendering a post.  But I've somehow painted myself into a corner with this approach and can't get it to work (my code match rules seem to always match the "versioned" posts and not the non-versioned posts).

Anyone have any tips on how to implement something like this on Hakyll?

Janne

Janne Hellsten

unread,
May 22, 2018, 11:11:38 AM5/22/18
to hak...@googlegroups.com
I found a reasonably OK solution by just moving the "posts in this series" into a separate template and then expanding it conditionally based on a "series" metadata value using a functionField

In case someone is curious about it, you can view the change here: https://github.com/nurpax/blog/commit/9a80803d81c8b8bcd348a437599e3e72316ef872

An automatic "list all posts with series=<some value>" would still be nice.

Janne


--
You received this message because you are subscribed to a topic in the Google Groups "hakyll" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hakyll/U3zKmOxXUwk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hakyll+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ebrplo...@gmail.com

unread,
Jul 15, 2019, 3:01:18 PM7/15/19
to hakyll
FYI, there's also Hakyll Series (https://github.com/oisdk/hakyll-series) that does the same thing.
To unsubscribe from this group and all its topics, send an email to hak...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages