Page 8 of 10 | View as a single page

Search Engine Optimization (SEO)

Now that your site features split pages (finally!), how do you optimize it for search engines?

paginator.seo has the following fields:

Field Description
canonical HTML link rel of the canonical URL (primary page for search results)
prev Ditto for the previous page, if applicable
next Ditto for the next page, if applicable
links All of the above, combined

You could simply add the following somewhere inside the <head> of your document:

{{ paginator.seo.links }}

It will produce up to three lines, like so (assuming you are on page 5):

  <link rel="canonical" href="https://example.com/2017/12/my-post/view-all/" />
  <link rel="prev" href="https://example.com/2017/12/my-post/4/" />
  <link rel="next" href="https://example.com/2017/12/my-post/6/" />

rel="prev" and/or rel="next" will not be included if there is no previous and/or next page, respectively. If you don’t want to set canonical to the single-view page, just set seo_canonical in your _config.yml to false.

Unified approach

It would be better to use the following approach, though:

{% unless paginator %}
  <link rel="canonical" href="{{ site.canonical }}{{ site.baseurl }}{{ page.url }}" />
{% endunless %}
{% if paginator.seo.links %}
{{ paginator.seo.links }}
{% else %}
  {% if paginator.previous_page_path %}
  <link rel="prev" href="{{ site.url }}{{ site.baseurl }}{{ paginator.previous_page_path }}" />
  {% endif %}
  {% if paginator.next_page_path %}
  <link rel="next" href="{{ site.url }}{{ site.baseurl }}{{ paginator.next_page_path }}" />
  {% endif %}
{% endif %}

This way it works with JPv2, JPC, and with no paginator active.

What about canonical for JPv2-generated pages? Unless you have a “view-all” page that includes all your unpaginated posts and you want search engines to use that possibly huge page as the primary search result, it is probably best to just not put a canonical link at all.

6 7 8 9 10