mardi 27 septembre 2016

Jekyll forloop.last --> before last?

I made a dummy "related posts" in Jekyll 3.2.1 with the following solution:

    

  1. The for loop iterates through the posts list in the site and gives it a limit
  2. If the author of the current post is the same as the author of the iterated post, but the title is not the same, then it fills out the jinja bindings.

The problem is with the part, cause if there is more iterable (post) in the forloop, it will display the <hr> tag, even if it's the last element shown to the user.

Is there any attribute to refer to the penultimate element of the list or any better solution to this?

Aucun commentaire:

Enregistrer un commentaire