CMS Development

TGerhard
Participant

Blog Pagination Link returns "This page is unavailable"

I've implemented a simple pagination on my blog listing page and the URLs that are generated look correct.  Unfortunately, whenever I try to click on my pagination to get to the next page I get an error message "This page is unavailable".

 

The URLs look like this: www.mydomain.com/blog/page/2

And I also have enough blog posts to justify a second page.

 

Pagination Snippet:

 

{# Blog pagination #}
        {% if contents.total_page_count > 1 %}
          <nav aria-label="Pagination" role="navigation">
            {% set page_list = [-2, -1, 0, 1, 2] %}
            {% if contents.total_page_count - current_page_num == 1 %}{% set offset = -1 %}
            {% elif contents.total_page_count - current_page_num == 0 %}{% set offset = -2 %}
            {% elif current_page_num == 2 %}{% set offset = 1 %}
            {% elif current_page_num == 1 %}{% set offset = 2 %}
            {% else %}{% set offset = 0 %}{% endif %}

            <a class="blog-pagination__link blog-pagination__prev-link {{ 'blog-pagination__prev-link--disabled' if !last_page_num }}"{% if last_page_num %} href="{% if current_page_num == 2 %}{{ group.absolute_url }} {% else %}{{ blog_page_link(last_page_num) }}{% endif %}" rel="prev"{% else %} aria-disabled="true" disabled {% endif %} role="button" aria-label="Go to previous page">
              Prev
            </a>
            {% for page in page_list %}
              {% set this_page = current_page_num + page + offset %}
              {% if this_page > 0 and this_page <= contents.total_page_count %}
                <a class="blog-pagination__link blog-pagination__number-link {{ 'blog-pagination__link--active' if this_page == current_page_num }}" aria-label="Go to Page {{ this_page }}" {% if this_page == current_page_num %}aria-current="true"{% endif %} href="{% if this_page == 1 %}{{ group.absolute_url }}{% else %}{{ blog_page_link(this_page) }}{% endif %}">{{ this_page }}</a>
              {% endif %}
            {% endfor %}
            <a class="blog-pagination__link blog-pagination__next-link {{ 'blog-pagination__next-link--disabled' if !next_page_num }}"{% if next_page_num %} href="{{ blog_page_link(current_page_num + 1) }}"  rel="prev" {% else %} aria-disabled="true" disabled {% endif %} role="button" aria-label="Go to next page">
              Next
            </a>
          </nav>
        {% endif %}
        {# End blog pagination #}

 

 

0 Upvotes
9 Replies 9
jonchim
Guide | Diamond Partner
Guide | Diamond Partner

Blog Pagination Link returns "This page is unavailable"

@TGerhard I've always used hs-sites with no issues, but yeah it does seem weird maybe there's a bug on hubspotpagebuilder.com

 






Jon Chim
VP of Design & Development
Hypha HubSpot Development


check Did my post help answer your query? Help the Community by marking it as a solution
John
Top Contributor | Platinum Partner
Top Contributor | Platinum Partner

Blog Pagination Link returns "This page is unavailable"

Here are some steps to test this:

  1. swap blog template to a native hs theme
  2. see if you are still getting a page unavailable message

If those other themes work, then its your code. If they don't, then you need to open a support ticket



I like kudos almost as much as cake – a close second.

0 Upvotes
TGerhard
Participant

Blog Pagination Link returns "This page is unavailable"

Apparently changing the domain from "hubspotpagebuilder.com" to "hs-sites.com" fixed both my errors.

It still seems weird to me though, that one of the test-domains has these kinds of issues. Can I expect this to be fixed anytime soon or should I switch to hs-sites instead?

jonchim
Guide | Diamond Partner
Guide | Diamond Partner

Blog Pagination Link returns "This page is unavailable"

Thanks @TGerhard looks like it's a hubspotpagebuilder domain issue. But i've confirmed that the pagination code you have above works in a live website, so it should work when you take the site live.






Jon Chim
VP of Design & Development
Hypha HubSpot Development


check Did my post help answer your query? Help the Community by marking it as a solution
0 Upvotes
TGerhard
Participant

Blog Pagination Link returns "This page is unavailable"

That's weird. Is this normal with hubspot?

I also have another url that seems to be affected by this: If you check https://fides.hubspotpagebuilder.com/events and scroll down a bit there are 3 elements that are printed:

{{request.query_dict }}
{{request.path_and_query}}
{{request}}

But for what ever reason, whenever you pass a query string it doesn't work. Also the request is without https.

 TGerhard_0-1618419840445.png

Is this related to that issue as well?

0 Upvotes
jonchim
Guide | Diamond Partner
Guide | Diamond Partner

Blog Pagination Link returns "This page is unavailable"

Hey @TGerhard,

Interesting your pagination code works perfect in my dev blog environment. I'm also testing using the hs-sites domain and have no issues. Would you be able to link us to that development site?






Jon Chim
VP of Design & Development
Hypha HubSpot Development


check Did my post help answer your query? Help the Community by marking it as a solution
0 Upvotes
TGerhard
Participant

Blog Pagination Link returns "This page is unavailable"

Of course. This is my blog url. I've set the "numbers of posts per listing page" to 1, so you can see the pagination: https://fides.hubspotpagebuilder.com/blog

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

Blog Pagination Link returns "This page is unavailable"

Hello @TGerhard 

Are you still working on this?

Going to get some 👀 on it!

@jonchim , @Anton you all have thoughts?

0 Upvotes
TGerhard
Participant

Blog Pagination Link returns "This page is unavailable"

Hi, yes this is still un-solved.

I don't know if this is relevant but I am currently working on a hubspotpagebuilder.com subdomain since I haven't connected my real domain yet.

0 Upvotes