<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Pagination Issue on the Blog in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Pagination-Issue-on-the-Blog/m-p/742100#M32334</link>
    <description>&lt;P&gt;Over the past two months we have been having issues with Pagination on our blog. The pages are generating -1 urls. See below:&lt;/P&gt;&lt;P&gt;About the pages ending in "/page/-1", they have the pattern of paginated posts that have gone too far backward (trying to view page -1). In this case, the blog's listing template doesn't remove the previous page button when viewing page/0 of the blog listing page, tag pages, or author pages.&lt;/P&gt;&lt;P&gt;For example,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://www.getmulberry.com/blog/tag/b2b/page/0" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.getmulberry.com/blog/tag/b2b/page/0&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;shows the previous page button (see screenshot). I have idenitified that this issue is coming from the HubL we are using to render the pagination on&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://app.hubspot.com/design-manager/8766947/modules/81459881064?tfid=42411940508" target="_blank" rel="nofollow noopener noreferrer"&gt;lines 94-134&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;of the blog-listing-new module.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code can be found below. Would love some suggestions on how to fix this.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; {% if contents.total_page_count &amp;gt; 1 %}
        &amp;lt;div class="blog-pagination pb-5"&amp;gt;
          {% if contents.total_page_count &amp;gt; 0 %}
          {% if widget.range == 10 %}
          {% set base = 10 %}
          {% set loop_ = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'] %}
          {% else %}
          {% set base = 5 %}
          {% set loop_ = ['1', '2', '3', '4', '5'] %}
          {% endif %}

          {% set current_pg_index = last_page_num + 1 %}
          {% set range_start = ((1 - current_pg_index) % base) + current_pg_index %}


          {% set range_end = range_start + (base)-1 %}

          {% set previous_range_start = ((6 - current_pg_index) % base) + current_pg_index - base  %}
          {% if previous_range_start &amp;lt; 1 %}
          {% set previous_range_start = 1 %}
          {% endif %}
          &amp;lt;ul&amp;gt;
            &amp;lt;li class="first-posts-link {% if current_pg_index &amp;lt;= 1 %}hide{% endif %}"&amp;gt;&amp;lt;a href="{{ blog_page_link(1) }}"&amp;gt;&amp;lt;i class="fa fa-angle-double-left"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
            &amp;lt;li class="previous-posts-link {% if !last_page_num %}hide{% endif %}"&amp;gt;&amp;lt;a href="{{ blog_page_link(last_page_num) }}"&amp;gt;&amp;lt;i class="fa fa-angle-left"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
            &amp;lt;span class="pg"&amp;gt;
              {% set i = range_start %}
              {% for pg in loop_ %} {# effectively, for i=1 to i=base #}
              {% if i &amp;lt;= contents.total_page_count %}
              &amp;lt;li{% if i == current_pg_index %} class="active"{% endif %}&amp;gt;&amp;lt;a href="{{ blog_page_link(i) }}"&amp;gt;{{ i }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;

              {% set i = i + 1 %}
              {% endif %}
              {% endfor %}
            &amp;lt;/span&amp;gt;
            &amp;lt;li class="next-posts-link {% if current_pg_index == contents.total_page_count %}hide{% endif %}"&amp;gt;&amp;lt;a href="{{ blog_page_link(next_page_num) }}"&amp;gt;&amp;lt;i class="fa fa-angle-right"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
            &amp;lt;li class="last-posts-link {% if current_pg_index == contents.total_page_count %}hide{% endif %}"&amp;gt;&amp;lt;a href="{{ blog_page_link(contents.total_page_count) }}"&amp;gt;&amp;lt;i class="fa fa-angle-double-right"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
          &amp;lt;/ul&amp;gt;
          {% endif %}
        &amp;lt;/div&amp;gt;
        {% endif %}
      &amp;lt;/div&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 16 Jan 2023 20:23:34 GMT</pubDate>
    <dc:creator>JRinger</dc:creator>
    <dc:date>2023-01-16T20:23:34Z</dc:date>
    <item>
      <title>Pagination Issue on the Blog</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Pagination-Issue-on-the-Blog/m-p/742100#M32334</link>
      <description>&lt;P&gt;Over the past two months we have been having issues with Pagination on our blog. The pages are generating -1 urls. See below:&lt;/P&gt;&lt;P&gt;About the pages ending in "/page/-1", they have the pattern of paginated posts that have gone too far backward (trying to view page -1). In this case, the blog's listing template doesn't remove the previous page button when viewing page/0 of the blog listing page, tag pages, or author pages.&lt;/P&gt;&lt;P&gt;For example,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://www.getmulberry.com/blog/tag/b2b/page/0" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.getmulberry.com/blog/tag/b2b/page/0&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;shows the previous page button (see screenshot). I have idenitified that this issue is coming from the HubL we are using to render the pagination on&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://app.hubspot.com/design-manager/8766947/modules/81459881064?tfid=42411940508" target="_blank" rel="nofollow noopener noreferrer"&gt;lines 94-134&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;of the blog-listing-new module.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code can be found below. Would love some suggestions on how to fix this.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; {% if contents.total_page_count &amp;gt; 1 %}
        &amp;lt;div class="blog-pagination pb-5"&amp;gt;
          {% if contents.total_page_count &amp;gt; 0 %}
          {% if widget.range == 10 %}
          {% set base = 10 %}
          {% set loop_ = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'] %}
          {% else %}
          {% set base = 5 %}
          {% set loop_ = ['1', '2', '3', '4', '5'] %}
          {% endif %}

          {% set current_pg_index = last_page_num + 1 %}
          {% set range_start = ((1 - current_pg_index) % base) + current_pg_index %}


          {% set range_end = range_start + (base)-1 %}

          {% set previous_range_start = ((6 - current_pg_index) % base) + current_pg_index - base  %}
          {% if previous_range_start &amp;lt; 1 %}
          {% set previous_range_start = 1 %}
          {% endif %}
          &amp;lt;ul&amp;gt;
            &amp;lt;li class="first-posts-link {% if current_pg_index &amp;lt;= 1 %}hide{% endif %}"&amp;gt;&amp;lt;a href="{{ blog_page_link(1) }}"&amp;gt;&amp;lt;i class="fa fa-angle-double-left"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
            &amp;lt;li class="previous-posts-link {% if !last_page_num %}hide{% endif %}"&amp;gt;&amp;lt;a href="{{ blog_page_link(last_page_num) }}"&amp;gt;&amp;lt;i class="fa fa-angle-left"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
            &amp;lt;span class="pg"&amp;gt;
              {% set i = range_start %}
              {% for pg in loop_ %} {# effectively, for i=1 to i=base #}
              {% if i &amp;lt;= contents.total_page_count %}
              &amp;lt;li{% if i == current_pg_index %} class="active"{% endif %}&amp;gt;&amp;lt;a href="{{ blog_page_link(i) }}"&amp;gt;{{ i }}&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;

              {% set i = i + 1 %}
              {% endif %}
              {% endfor %}
            &amp;lt;/span&amp;gt;
            &amp;lt;li class="next-posts-link {% if current_pg_index == contents.total_page_count %}hide{% endif %}"&amp;gt;&amp;lt;a href="{{ blog_page_link(next_page_num) }}"&amp;gt;&amp;lt;i class="fa fa-angle-right"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
            &amp;lt;li class="last-posts-link {% if current_pg_index == contents.total_page_count %}hide{% endif %}"&amp;gt;&amp;lt;a href="{{ blog_page_link(contents.total_page_count) }}"&amp;gt;&amp;lt;i class="fa fa-angle-double-right"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
          &amp;lt;/ul&amp;gt;
          {% endif %}
        &amp;lt;/div&amp;gt;
        {% endif %}
      &amp;lt;/div&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 20:23:34 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Pagination-Issue-on-the-Blog/m-p/742100#M32334</guid>
      <dc:creator>JRinger</dc:creator>
      <dc:date>2023-01-16T20:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: Pagination Issue on the Blog</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Pagination-Issue-on-the-Blog/m-p/742554#M32345</link>
      <description>&lt;P&gt;I would try changing&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% if !last_page_num %}hide{% endif %}&lt;/LI-CODE&gt;
&lt;P&gt;to&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% if !last_page_num || current_pg_index &amp;lt; 1 %}hide{% endif %}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 14:10:41 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Pagination-Issue-on-the-Blog/m-p/742554#M32345</guid>
      <dc:creator>alyssamwilie</dc:creator>
      <dc:date>2023-01-17T14:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: Pagination Issue on the Blog</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Pagination-Issue-on-the-Blog/m-p/742908#M32351</link>
      <description>&lt;P&gt;Thanks. I tried making this change and then crueled the site and am still having the same problem.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 23:03:26 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Pagination-Issue-on-the-Blog/m-p/742908#M32351</guid>
      <dc:creator>JRinger</dc:creator>
      <dc:date>2023-01-17T23:03:26Z</dc:date>
    </item>
    <item>
      <title>Re: Pagination Issue on the Blog</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Pagination-Issue-on-the-Blog/m-p/742926#M32354</link>
      <description>&lt;P&gt;Did you &lt;A href="https://its.uiowa.edu/support/article/719" target="_blank"&gt;clear your cache&lt;/A&gt;? I just went to a few /page/0 pages and I'm not seeing the previous button anymore.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screen Shot 2023-01-17 at 5.41.12 PM.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/83305iDB4630EBEC7ADDC7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screen Shot 2023-01-17 at 5.41.12 PM.png" alt="Screen Shot 2023-01-17 at 5.41.12 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 23:42:47 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Pagination-Issue-on-the-Blog/m-p/742926#M32354</guid>
      <dc:creator>alyssamwilie</dc:creator>
      <dc:date>2023-01-17T23:42:47Z</dc:date>
    </item>
  </channel>
</rss>

