From 220901c140d595963946750e932955ca2e8e9836 Mon Sep 17 00:00:00 2001 From: Todd Eichel Date: Wed, 11 May 2016 15:02:07 -0700 Subject: [PATCH] Different philosophy for rel prev/next links based on recommendations from Google. Details here: https://webmasters.googleblog.com/2011/09/pagination-with-relnext-and-relprev.html. This replaces the per-page prev/next links with general ones that will be output whenever there is a paginator with a previous or next page to show. --- README.md | 2 +- lib/jekyll-seo-tag.rb | 1 + lib/template.html | 13 ++++++------- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 132b651..996456d 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Jekyll SEO Tag adds the following meta tags to your site: * Pages title (with site title appended when available) * Page description * Canonical URL -* Next and previous URLs for posts +* Next and previous URLs on paginated pages * [JSON-LD Site and post metadata](https://developers.google.com/structured-data/) for richer indexing * [Open graph](http://ogp.me/) title, description, site title, and URL (for Facebook, LinkedIn, etc.) * [Twitter summary card](https://dev.twitter.com/cards/overview) metadata diff --git a/lib/jekyll-seo-tag.rb b/lib/jekyll-seo-tag.rb index 1e10877..1c98cde 100644 --- a/lib/jekyll-seo-tag.rb +++ b/lib/jekyll-seo-tag.rb @@ -30,6 +30,7 @@ module Jekyll { 'page' => context.registers[:page], 'site' => context.registers[:site].site_payload['site'], + 'paginator' => context['paginator'], 'seo_tag' => options } end diff --git a/lib/template.html b/lib/template.html index 59756a1..20d57b2 100644 --- a/lib/template.html +++ b/lib/template.html @@ -139,14 +139,13 @@ {% if page.date %} +{% endif %} - {% if page.next.url %} - - {% endif %} - - {% if page.previous.url %} - - {% endif %} +{% if paginator.previous_page %} + +{% endif %} +{% if paginator.next_page %} + {% endif %} {% if site.twitter %}