Radical Design Course by Jack McDade

From the creator of Statamic

Learn how to make your websites standout and be remembered.

For a software dev like me who has no idea how to create a cute hand-drawn dashed line, this course just 100% works.

— Ira Zayats, Developer

Collection:Next Tag

If you're on a single entry page and want to show next entries in order (publish date, alphabetical, or manual), this is the tag you're looking for.

Date Order

This tag relies on the native publish date field for date ordering.

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:next 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:next }}
<statamic:collection:next
in="blog"
as="posts"
limit="2"
sort="date:asc"
>
@if ($no_results)
No more posts to read!
@endif
 
@foreach ($posts as $post)
<div class="post">
<a href="{{ $post->url }}">{{ $post->title }}</a>
</div>
@endforeach
</statamic:collection:next>
Hot Tip!

This functions the same way as the collection:previous 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.

Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →