Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Prev_Next page?

Started by Muut Archive 11 years ago · 2 replies · 275 views
11 years ago

Hi, how can I get a prev next navigation in my site? I use antimatter theme, no subpages. All pages called default.md
Thanks

11 years ago

Well.. your pages has to be in collection in order for prev next to work. Seehttp://learn.getgrav.org/themes/theme-vars#nextsibling
Then you can try this code.

HTML
<p class="prev-next">
   {% if not page.isFirst %}
     <a class="button" href="{{ page.nextSibling.url }}"><i class="fa fa-chevron-left"></i> Next Post</a>
   {% endif %}

   {% if not page.isLast %}
     <a class="button" href="{{ page.prevSibling.url }}">Previous Post <i class="fa fa-chevron-right"></i></a>
   {% endif %}
</p>
11 years ago

Is that right:

in my system.yaml:
content:
order:
by: default
dir: asc
pagination: true

Then your code in base.html.twig?

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1328 9 years ago
Archive · by Muut Archive, 9 years ago
2 921 9 years ago
Archive · by Muut Archive, 9 years ago
2 4050 9 years ago
Archive · by Muut Archive, 9 years ago
1 2928 9 years ago
Archive · by Muut Archive, 9 years ago
3 1107 9 years ago