Collection:Previous Tag

If you're on a single entry page and want to show previous entries in order, this is the tag you want. It doesn't matter whether the collection is ordered alphabetically, by date, or manually.

Example

This will show the next 2 posts in a blog collection. It’ll scope the entries loop into the posts tag pair. If there are no more entries, the no results text will be shown.

{{ collection:previous in="blog" as="posts" limit="2" sort="date:asc" }}

  {{ if no_results }}
    No more posts to read!
  {{ /if }}

  {{ posts }}
    <div class="post">
      <a href="{{ url }}">{{ title }}</a>
    </div>
  {{ /posts }}

{{ /collection:previous }}

This functions the same way as the collection:next tag but in the opposite direction.

Parameters

in|collection string

Explicitly define a collection. Defaults to whatever collection the current entry is in.

current string

Explicitly define a current entry by id. Defaults to the current entry in context.

collection params inheritance

All collection tag parameters are available.

Variables

Variable Type Description

no_results

boolean

true if no results.

Betterify this page on Github!