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

Learn2 Theme: prev/next not working

Started by Muut Archive 10 years ago · 2 replies · 888 views
10 years ago

Hey guys,
Im currently having a problem with the Learn2 prev/next buttons..
Their href is empty..

inside docs.html.twig:

TWIG
{% extends 'partials/base.html.twig' %}
{% set tags = page.taxonomy.tag %}

{% if tags %}

    {% set progress = page.collection({'items':{'@taxonomy':{'category': 'docs', 'tag': tags}},'order': {'by': 'default', 'dir': 'asc'}}) %}
{% else %}
    {% set progress = page.collection({'items':{'@taxonomy':{'category': 'docs'}},'order': {'by': 'default', 'dir': 'asc'}}) %}
{% endif %}

{% block navigation %}
    <div id="navigation">
    {% if not progress.isFirst(page.path) %}
        <a class="nav nav-prev" href="{{ progress.nextSibling(page.path).url }}"> <i class="fa fa-chevron-left"></i></a>
    {% endif %} 

    {% if not progress.isLast(page.path) %}
        <a class="nav nav-next" href="{{ progress.prevSibling(page.path).url }}"><i class="fa fa-chevron-right"></i></a>
    {% endif %}
    </div>
{% endblock %}

{% block content %}
    {% include 'partials/page.html.twig' %}
{% endblock %}

When i debug "progress.nextSibling(page.path).url" it results null.
Seems like the nextSibling cant be found.. Maybe "progress" is having some problem with location.

Any suggestions?

10 years ago

For me it worked after tagging the pages with the same taxonomy:

YAML

taxonomy:
    category:
        - docs
10 years ago

For me it worked after tagging the pages with the same taxonomy:
taxonomy:
category:

  • docs

Thanks, it works now :)

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1359 9 years ago
Archive · by Muut Archive, 9 years ago
2 936 9 years ago
Archive · by Muut Archive, 9 years ago
2 4066 9 years ago
Archive · by Muut Archive, 9 years ago
1 2955 9 years ago
Archive · by Muut Archive, 9 years ago
3 1121 9 years ago