diff --git a/Gemfile b/Gemfile index 1475b55..a215af7 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,16 @@ source 'https://rubygems.org' +require 'json' +require 'open-uri' -# Specify your gem's dependencies in jekyll_seo_tags.gemspec gemspec -gem 'github-pages' +group :development, :test do + versions = JSON.parse(open('https://pages.github.com/versions.json').read) + versions.delete('ruby') + versions.delete('jekyll-seo-tag') + versions.delete('github-pages') + + versions.each do |dep, version| + gem dep, version + end +end diff --git a/lib/template.html b/lib/template.html index 53dca26..9a77b4c 100644 --- a/lib/template.html +++ b/lib/template.html @@ -4,28 +4,32 @@ {% assign seo_url = site.url | append: site.baseurl %} {% endif %} {% assign seo_url = seo_url | default: site.github.url %} - {% assign seo_site_title = site.title | default: site.name %} {% if page.title %} {% assign seo_title = page.title %} {% assign seo_page_title = page.title %} + {% if seo_site_title %} {% assign seo_title = seo_title | append:" - " | append: seo_site_title %} {% endif %} {% elsif seo_site_title %} {% assign seo_title = seo_site_title %} {% assign seo_page_title = seo_site_title %} + {% if site.description %} {% assign seo_title = seo_title | append:" - " | append: site.description %} {% endif %} {% endif %} + {% if seo_title %} {% assign seo_title = seo_title | markdownify | strip_html | strip_newlines | escape_once %} {% endif %} + {% if seo_site_title %} {% assign seo_site_title = seo_site_title | markdownify | strip_html | strip_newlines | escape_once %} {% endif %} + {% if seo_page_title %} {% assign seo_page_title = seo_page_title | markdownify | strip_html | strip_newlines | escape_once %} {% endif %} @@ -39,6 +43,7 @@ {% assign seo_author_name = page.author.name | default: page.author %} {% assign seo_author_twitter = page.author.twitter | default: page.author %} {% endif %} + {% if seo_author_twitter %} {% assign seo_author_twitter = seo_author_twitter | replace:"@","" | prepend:"@" %} {% endif %} @@ -84,6 +89,7 @@ {% if page.next.url %} {% endif %} + {% if page.previous.url %} {% endif %} @@ -105,9 +111,11 @@ + {% if page.image %} {% endif %} + {% if seo_author_twitter %} {% endif %} @@ -116,6 +124,7 @@ {% if site.facebook %} +{% endif %} {% if site.google_site_verification %} diff --git a/spec/fixtures/_posts/2015-01-01-post.md b/spec/fixtures/_posts/2015-01-01-post.md index bd3048e..a91a54d 100644 --- a/spec/fixtures/_posts/2015-01-01-post.md +++ b/spec/fixtures/_posts/2015-01-01-post.md @@ -3,3 +3,5 @@ title: Some "post" & a test description: A post layout: default --- + +Blah blah diff --git a/spec/fixtures/_posts/2015-01-02-other-post.md b/spec/fixtures/_posts/2015-01-02-other-post.md index 0d6905d..bb25167 100644 --- a/spec/fixtures/_posts/2015-01-02-other-post.md +++ b/spec/fixtures/_posts/2015-01-02-other-post.md @@ -1,3 +1,5 @@ --- layout: default --- + +Blah blah