Previous in Series and Next In Series links

Sorry for digging so deep in history, but I solved that problem.

I used that to generate blog series links on my blog: www.itchyfeet.pl (blog is in polish)

My piece of code is following:

{{ range where .Site.Pages.ByDate "Params.series" .Params.series }}
    {{ if gt $.Date.Unix .Date.Unix }}
      {{ $.Scratch.Set "previous" .Permalink }}
    {{ end }}
{{ end }}
{{ range where .Site.Pages.ByDate.Reverse "Params.series" .Params.series }}
    {{ if lt $.Date.Unix .Date.Unix }}
      {{ $.Scratch.Set "next" .Permalink }}
    {{ end }}
{{ end }}

<ul class="actions pagination">
<li><a href="{{ if $.Scratch.Get "previous" }}{{ $.Scratch.Get "previous" }} {{ end }}" class="{{ if not ($.Scratch.Get "previous") }}disabled {{ end }}button big previous">Next</a></li>
<li><a href="{{ if $.Scratch.Get "next" }}{{ $.Scratch.Get "next" }} {{ end }}" class="{{ if not ($.Scratch.Get "next") }}disabled {{ end }}button big next">Previous</a></li>
</ul>
3 Likes