I'm having trouble limiting next/previous links in one channel to articles by the author.
next/previous links are working correctly on the regular blog but when included on the DJ blog I get unknown property errors
in the template.
If I remove the merge line below pagination appears to work, but includes DJ posts not by the current Dj.
url looks like https://domain.com/djs/503/firstName-lastName
where 503 is the author.id
{# Set parameters for prev/next elements list #}
{% set params = craft.entries.section(channel).orderBy('title asc') %}
{# if djs channel limit to author based on url segment 2 which is author id #}
{% if craft.app.request.segment(1) == 'djs' %}
{# get dj to relate and limit next/prev #}
{% set author = craft.app.request.getSegment(2) %}
{# {% set dj = craft.users.id(author).one() %} #}
{# {% set params = craft.entries.section('djBlog').relatedTo(author).orderBy('title asc') %} #}
{% set params = params | merge({ relatedTo: author }) %}
{% endif %}
Below code is working on all other templates except the DJ blog where I need to restrict pagination to posts by the current author. Only including here in case it may be relevant though I don't think so.
<div class="entry-pagination grid-container"> {# grid-container #}
<div class="grid-x grid-padding-x">
<div class="cell small-12 {% if backToPath == 'the-word-for-you-today' %}medium-12{% else %}medium-8 medium-offset-2{% endif %} next-prev">
{% if prevEntry %}
<a href="{{ prevEntry.url }}" class="prev-blog">
{#<img src="/assets/images/previous.png" alt="">#}
{{ macros.icon("next", "icon-blue", "40", "40") }}
Previous
</a>
{% else %}
<a href="" class="prev-blog" disabled="true">
{#<img src="/assets/images/previous.png" alt="">#}
{{ macros.icon("next", "icon-blue", "40", "40") }}
Previous
</a>
{% endif %}
{% if backTo == 'true' %}
<a href="/{{ backToPath }}" class="button">
Back to {{ backToTitle }}
{# <img src="/assets/images/previous.png" alt=""> #}
</a><!-- /.button -->
{% endif %}
{% if nextEntry %}
<a href="{{ nextEntry.url }}" class="next-blog"><span>Next</span>{{ macros.icon("next", "icon-blue", "40", "40") }}</a>
{% else %}
<a href="" class="next-blog" disabled="true"><span>Next</span>{{ macros.icon("next", "icon-blue", "40", "40") }}</a>
{% endif %}
</div><!-- /.cell small-12 -->
</div><!-- /.grid-x grid-padding-x -->
</div><!-- /.grid-container -->