Blog, Website & Page Publishing

dit
Participant

Duplicate blog listing page

SOLVE

Hello,

 

Our SEO team have indicated that we have a duplicate page for our blog and each category within our blog.

 

We have blog.domain.com and blog.domain.com/page/1, they show identical content. Is there any way to kill off page/1 of each?

0 Upvotes
1 Accepted solution
MatthewShepherd
Solution
Key Advisor

Duplicate blog listing page

SOLVE

Hi @dit 

 

Best practice is to have self-referencing canonical URLs for all paginated pages, so yes, in most cases don't point canonicals to the first page, but everyone's paginated pages, content, and site is different, so this setting exists so that your SEO can test and make the best call. I rarely find that paginated pages add value to the search results.

I would argue "...setting the blog listing page's canonical URL to the first page prevents search engines from finding any subsequent paginated pages." isn't technically correct as Google will crawl the pagination links, discover the content and make its own call as to whether to honour the canonical.

 

Another approach to this would be to change your blog listings templates pagination code to point the first paginate link to / instead of /page/1.  Your pagination code might look something like this

 

 

{% if not simple_list_page %}
        <div class="blog-pagination">
        {% 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 %}

        <div class="blog-pagination-left">
            {% if last_page_num %}<a class="prev-link" href="{{ blog_page_link(last_page_num) }}"><i class="fa fa-angle-double-left"></i></a>{% endif %}
            {% if contents.total_page_count > 5 %}
                {% if current_page_num >= 4 %}
                    <a href="{{ blog_page_link(1) }}" >1</a>
                    <a class="elipses" href="{% if current_page_num <= 5 %}{{ blog_page_link(1) }}{% else %}{{ blog_page_link(current_page_num - 5) }}{% endif %}">...</a>
                {% endif %}
            {% endif %}
        </div>
        <div class="blog-pagination-center">
            {% 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 {% if this_page == current_page_num %}class="active"{% endif %} href="{{ blog_page_link(this_page) }}">{{ this_page }}</a>
                {% endif %}
            {% endfor %}
        </div>
        <div class="blog-pagination-right">
            {% if contents.total_page_count > 5 %}
                {% if contents.total_page_count - current_page_num > 2 %}
                    <a class="elipses" href="{% if contents.total_page_count - current_page_num <= 5 %}{{ contents.total_page_count }}{% else %}{{ blog_page_link(current_page_num + 5) }}{% endif %}">...</a>
                    <a href="{{ blog_page_link(contents.total_page_count) }}">{{ contents.total_page_count }}</a>
                {% endif %}
            {% endif %}
            {% if next_page_num %}<a class="next-link" href="{{ blog_page_link(current_page_num + 1) }}"><i class="fa fa-angle-double-right"></i></a>{% endif %}
        </div>
        </div>
        {% endif %}
    </div>


You could change the code as follows (changes in bold) to check if this is the first page of pagination and set it to your default blog page ( {{ group.absolute_url }} - or replace that with href="/" if you prefer.)

 

 

 

        {% if not simple_list_page %}
        <div class="blog-pagination">
        {% 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 %}

        <div class="blog-pagination-left">
            {% if last_page_num %}<a class="prev-link" href="{{ group.absolute_url }}"><i class="fa fa-angle-double-left"></i></a>{% endif %}
            {% if contents.total_page_count > 5 %}
                {% if current_page_num >= 4 %}
                    <a href="{{ blog_page_link(1) }}" >1</a>
                    <a class="elipses" href="{% if current_page_num <= 5 %}{{ blog_page_link(1) }}{% else %}{{ blog_page_link(current_page_num - 5) }}{% endif %}">...</a>
                {% endif %}
            {% endif %}
        </div>
        <div class="blog-pagination-center">
            {% for page in page_list %}
                {% set this_page = current_page_num + page + offset %}
                {% if this_page > 0 and this_page <= contents.total_page_count %}
                   {% if this_page == 1 %}
                   <a {% if this_page == current_page_num %}class="active"{% endif %} href="{{ group.absolute_url }}">{{ this_page }}</a>
                   {% else %} 
                    <a {% if this_page == current_page_num %}class="active"{% endif %} href="{{ blog_page_link(this_page) }}">{{ this_page }}</a>
                   {% endif %}
                {% endif %}
            {% endfor %}
        </div>
        <div class="blog-pagination-right">
            {% if contents.total_page_count > 5 %}
                {% if contents.total_page_count - current_page_num > 2 %}
                    <a class="elipses" href="{% if contents.total_page_count - current_page_num <= 5 %}{{ contents.total_page_count }}{% else %}{{ blog_page_link(current_page_num + 5) }}{% endif %}">...</a>
                    <a href="{{ blog_page_link(contents.total_page_count) }}">{{ contents.total_page_count }}</a>
                {% endif %}
            {% endif %}
            {% if next_page_num %}<a class="next-link" href="{{ blog_page_link(current_page_num + 1) }}"><i class="fa fa-angle-double-right"></i></a>{% endif %}
        </div>
        </div>
        {% endif %}

 

 

Note this doesn't stop the blog /page/1 being generated, you just won't be linking to it. Another approach could be to check if the url path contains /page/1 and noindex (just) that pagination page or add a canonical (if you haven't already set a canonical via the blog settings.)  Add something like the following to  your blog listing pages header HTML

 

 

{% if request.path is string_containing "/page/1" %}
<meta name="robots" content="noindex">
{% endif %}

 

 

 

Matthew Shepherd

Freelance HubSpot Consultant
CRM Consultant | SEO Specialist

Did my post help answer your query?Help the community by marking it as a solution.

View solution in original post

11 Replies 11
MatthewShepherd
Key Advisor

Duplicate blog listing page

SOLVE

Hi @dit 

 

The /page/1 is part of your blog listing template's pagination functionality. Instead of killing it off you could set the canonical for each paginated page of your blog to point back to the first page.

 

hs-blog-canonical.PNG

 

 

This article explains how to do this: https://knowledge.hubspot.com/articles/kcs_article/cos-blog/how-does-hubspot-address-duplicate-conte...

Matthew Shepherd

Freelance HubSpot Consultant
CRM Consultant | SEO Specialist

Did my post help answer your query?Help the community by marking it as a solution.
0 Upvotes
dit
Participant

Duplicate blog listing page

SOLVE

Hi Matthew, 

 

Thanks for the link but I'm a bit confused as this specifically mentions not setting canonical URLs to the listing pages:

 

Please note: for the Blog listing pages setting, HubSpot recommends that you don't add canonical URLs to blog listing pages. While search engines may flag blog listing pages as duplicate content, setting the blog listing page's canonical URL to the first page prevents search engines from finding any subsequent paginated pages.

0 Upvotes
MatthewShepherd
Solution
Key Advisor

Duplicate blog listing page

SOLVE

Hi @dit 

 

Best practice is to have self-referencing canonical URLs for all paginated pages, so yes, in most cases don't point canonicals to the first page, but everyone's paginated pages, content, and site is different, so this setting exists so that your SEO can test and make the best call. I rarely find that paginated pages add value to the search results.

I would argue "...setting the blog listing page's canonical URL to the first page prevents search engines from finding any subsequent paginated pages." isn't technically correct as Google will crawl the pagination links, discover the content and make its own call as to whether to honour the canonical.

 

Another approach to this would be to change your blog listings templates pagination code to point the first paginate link to / instead of /page/1.  Your pagination code might look something like this

 

 

{% if not simple_list_page %}
        <div class="blog-pagination">
        {% 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 %}

        <div class="blog-pagination-left">
            {% if last_page_num %}<a class="prev-link" href="{{ blog_page_link(last_page_num) }}"><i class="fa fa-angle-double-left"></i></a>{% endif %}
            {% if contents.total_page_count > 5 %}
                {% if current_page_num >= 4 %}
                    <a href="{{ blog_page_link(1) }}" >1</a>
                    <a class="elipses" href="{% if current_page_num <= 5 %}{{ blog_page_link(1) }}{% else %}{{ blog_page_link(current_page_num - 5) }}{% endif %}">...</a>
                {% endif %}
            {% endif %}
        </div>
        <div class="blog-pagination-center">
            {% 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 {% if this_page == current_page_num %}class="active"{% endif %} href="{{ blog_page_link(this_page) }}">{{ this_page }}</a>
                {% endif %}
            {% endfor %}
        </div>
        <div class="blog-pagination-right">
            {% if contents.total_page_count > 5 %}
                {% if contents.total_page_count - current_page_num > 2 %}
                    <a class="elipses" href="{% if contents.total_page_count - current_page_num <= 5 %}{{ contents.total_page_count }}{% else %}{{ blog_page_link(current_page_num + 5) }}{% endif %}">...</a>
                    <a href="{{ blog_page_link(contents.total_page_count) }}">{{ contents.total_page_count }}</a>
                {% endif %}
            {% endif %}
            {% if next_page_num %}<a class="next-link" href="{{ blog_page_link(current_page_num + 1) }}"><i class="fa fa-angle-double-right"></i></a>{% endif %}
        </div>
        </div>
        {% endif %}
    </div>


You could change the code as follows (changes in bold) to check if this is the first page of pagination and set it to your default blog page ( {{ group.absolute_url }} - or replace that with href="/" if you prefer.)

 

 

 

        {% if not simple_list_page %}
        <div class="blog-pagination">
        {% 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 %}

        <div class="blog-pagination-left">
            {% if last_page_num %}<a class="prev-link" href="{{ group.absolute_url }}"><i class="fa fa-angle-double-left"></i></a>{% endif %}
            {% if contents.total_page_count > 5 %}
                {% if current_page_num >= 4 %}
                    <a href="{{ blog_page_link(1) }}" >1</a>
                    <a class="elipses" href="{% if current_page_num <= 5 %}{{ blog_page_link(1) }}{% else %}{{ blog_page_link(current_page_num - 5) }}{% endif %}">...</a>
                {% endif %}
            {% endif %}
        </div>
        <div class="blog-pagination-center">
            {% for page in page_list %}
                {% set this_page = current_page_num + page + offset %}
                {% if this_page > 0 and this_page <= contents.total_page_count %}
                   {% if this_page == 1 %}
                   <a {% if this_page == current_page_num %}class="active"{% endif %} href="{{ group.absolute_url }}">{{ this_page }}</a>
                   {% else %} 
                    <a {% if this_page == current_page_num %}class="active"{% endif %} href="{{ blog_page_link(this_page) }}">{{ this_page }}</a>
                   {% endif %}
                {% endif %}
            {% endfor %}
        </div>
        <div class="blog-pagination-right">
            {% if contents.total_page_count > 5 %}
                {% if contents.total_page_count - current_page_num > 2 %}
                    <a class="elipses" href="{% if contents.total_page_count - current_page_num <= 5 %}{{ contents.total_page_count }}{% else %}{{ blog_page_link(current_page_num + 5) }}{% endif %}">...</a>
                    <a href="{{ blog_page_link(contents.total_page_count) }}">{{ contents.total_page_count }}</a>
                {% endif %}
            {% endif %}
            {% if next_page_num %}<a class="next-link" href="{{ blog_page_link(current_page_num + 1) }}"><i class="fa fa-angle-double-right"></i></a>{% endif %}
        </div>
        </div>
        {% endif %}

 

 

Note this doesn't stop the blog /page/1 being generated, you just won't be linking to it. Another approach could be to check if the url path contains /page/1 and noindex (just) that pagination page or add a canonical (if you haven't already set a canonical via the blog settings.)  Add something like the following to  your blog listing pages header HTML

 

 

{% if request.path is string_containing "/page/1" %}
<meta name="robots" content="noindex">
{% endif %}

 

 

 

Matthew Shepherd

Freelance HubSpot Consultant
CRM Consultant | SEO Specialist

Did my post help answer your query?Help the community by marking it as a solution.
PBifaro
Member

Duplicate blog listing page

SOLVE

will this string work for multiple pages? Some of our categories have 12 or more pages.

0 Upvotes
LoganThompson
Participant

Duplicate blog listing page

SOLVE

I tried this fix but it sets all page 1's for tag and author listing pages to the main blog URL. I figured out a change instead of using {{ group.absolute_url }}

 

Here's my code with the updates if anyone is interested.

 

{% if this_page == 1 %}
  <a {% if this_page == current_page_num %}class="active"{% endif %} href="{{ blog_page_link(this_page)|split('/page', 2)|first }}">{{ this_page }}</a>
{% else %} 

 

0 Upvotes
Jhon
Member

Duplicate blog listing page

SOLVE

or we could use {{ content.absolute_url }} so it won't matter if its the main or tag or author listing page



0 Upvotes
kvlschaefer
Community Manager
Community Manager

Duplicate blog listing page

SOLVE

Thanks for sharing this with the Community, @LoganThompson


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !
0 Upvotes
Woodsy
Top Contributor

Duplicate blog listing page

SOLVE

Hi Matthew

I have implemented the pagination which works fine when there are a few pages. Selecting pagination 1 goes back to /news. If however I click on pagination 5 or higher then click 1 it goes to /news/page/1.

 

Is there a way to make clicking on 1 go back to /news no matter which pagination page you are on?

 

Thanks

0 Upvotes
MatthewShepherd
Key Advisor

Duplicate blog listing page

SOLVE

Hi @Woodsy 

Try replacing any instances of {{ blog_page_link(1) }} in the code above with {{ group.absolute_url }}

Matthew Shepherd

Freelance HubSpot Consultant
CRM Consultant | SEO Specialist

Did my post help answer your query?Help the community by marking it as a solution.
0 Upvotes
Codyrg2006
Participant | Elite Partner
Participant | Elite Partner

Duplicate blog listing page

SOLVE

Is this important for SEO? Would this improve it?

0 Upvotes
MatthewShepherd
Key Advisor

Duplicate blog listing page

SOLVE

Hi @Codyrg2006 
This wouldn't be high on my list of SEO priorities unless it was generating a very large number of duplicate URLs, but generating duplicate URLs for the same content is sub-optimal for SEO as it wastes crawl budget, meaning search engines may not be crawling as much of your site as regularly as you want.

Duplicate content also means search engines are left to decide which version of your page to filter out of search results, meaning the search engines chooses which version of the page receives traffic and it may not be the one we prefer.

Matthew Shepherd

Freelance HubSpot Consultant
CRM Consultant | SEO Specialist

Did my post help answer your query?Help the community by marking it as a solution.
0 Upvotes