Pagination: Next/Previous related to author 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.

&lt;div class="entry-pagination grid-container"&gt; {# grid-container #}
  &lt;div class="grid-x grid-padding-x"&gt;
    &lt;div class="cell small-12 {% if backToPath == 'the-word-for-you-today' %}medium-12{% else %}medium-8 medium-offset-2{% endif %} next-prev"&gt;

      {% if prevEntry %}        
        &lt;a href="{{ prevEntry.url }}" class="prev-blog"&gt;
          {#&lt;img src="/assets/images/previous.png" alt=""&gt;#}
          {{ macros.icon("next", "icon-blue", "40", "40") }}
           Previous
        &lt;/a&gt;
      {% else %}
        &lt;a href="" class="prev-blog" disabled="true"&gt;
          {#&lt;img src="/assets/images/previous.png" alt=""&gt;#}
          {{ macros.icon("next", "icon-blue", "40", "40") }}
           Previous
        &lt;/a&gt;    
      {% endif %}

      {% if backTo == 'true' %}
        &lt;a href="/{{ backToPath }}" class="button"&gt;
          Back to {{ backToTitle }}
          {# &lt;img src="/assets/images/previous.png" alt=""&gt; #}
        &lt;/a&gt;&lt;!-- /.button --&gt;
      {% endif %}


      {% if nextEntry %}
        &lt;a href="{{ nextEntry.url }}" class="next-blog"&gt;&lt;span&gt;Next&lt;/span&gt;{{ macros.icon("next", "icon-blue", "40", "40") }}&lt;/a&gt;
      {% else %}
        &lt;a href="" class="next-blog" disabled="true"&gt;&lt;span&gt;Next&lt;/span&gt;{{ macros.icon("next", "icon-blue", "40", "40") }}&lt;/a&gt;
      {% endif %}
    &lt;/div&gt;&lt;!-- /.cell small-12 --&gt;
  &lt;/div&gt;&lt;!-- /.grid-x grid-padding-x --&gt;
&lt;/div&gt;&lt;!-- /.grid-container --&gt;
You are trying to merge an object of type ElementQuery with an array so your object will be transformed as an array and merged with the new array. Of course you'll end up having an array instead of a query so you can't execute it in order to fetch the entries.

Instead of merging it, why not setting the parameter directly?

{% do param.authorId(author) %}


Furthermore authors are not related to entries  (except you set them in an additional field)