Add the nofollow attribute to the rel attribute of the "Show More" link

Created on 19 December 2024, 4 months ago

Request: Please add the nofollow attribute to the rel attribute of the "Show More" link.

I tried adding it manually in the views-infinite-scroll-pager.html.twig template file, but the pager stopped working afterward. Here is the code I modified:

{#
/**
 * @file
 * The views infinite scroll pager template.
 */
#}

{% if items.next %}
<ul{{ attributes }}>
  <li class="pager__item">
    <a class="button" href="{{ items.next.href }}" title="{{ 'Load more items'|t }}" rel="next nofollow">{{ options.button_text }}</a>
  </li>
</ul>
{% endif %}

Could you update the module to accept a second rel attribute, such as nofollow, without breaking functionality? This would be useful for avoiding bot or crawler traffic. Thank you!

Feature request
Status

Active

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mateb
  • 🇮🇳India prem suthar Ahemdabad- Gujrat , Jodhpur - Rajsthan

    @mateb i have tested on the 11.2-dev and install the 2.0.3 version module after added the nofollow manually then pager is working fine and we can load more items.

  • @prem suthar: Can you show your TWIG template, please?

  • 🇮🇳India prem suthar Ahemdabad- Gujrat , Jodhpur - Rajsthan
    {#
    /**
     * @file
     * The views infinite scroll pager template.
     */
    #}
    
    {% if items.next %}
    <ul{{ attributes }}>
      <li class="pager__item">
        <a class="button" href="{{ items.next.href }}" title="{{ 'Load more items'|t }}" rel="next nofollow">{{ options.button_text }}</a>
      </li>
    </ul>
    {% endif %}

    here is the my twig file of module

  • Thank you, this is the same code as mine.

    Unfortunately, with this code, the pagination stops working for me.

    It seems that the module can only process the first attribute, and only the rel="next" is accepted. The second rel="nofollow" attribute breaks its functionality.

  • 🇮🇳India prem suthar Ahemdabad- Gujrat , Jodhpur - Rajsthan

    For me when i click on the load more button then i redirect to the 2nd page .

  • First commit to issue fork.
Production build 0.71.5 2024