From 6dab82639ea393f93033efc5e3f5005e864de2b4 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 25 Jan 2016 14:29:48 -0800 Subject: [PATCH] use the page.excerpt if the page.description doesn't exist --- lib/template.html | 2 ++ spec/jekyll_seo_tag_spec.rb | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/template.html b/lib/template.html index 7b7e69b..4326fa3 100644 --- a/lib/template.html +++ b/lib/template.html @@ -37,6 +37,8 @@ {% if page.description %} {% assign seo_description = page.description %} +{% elsif page.excerpt %} + {% assign seo_description = page.excerpt %} {% elsif site.description %} {% assign seo_description = site.description %} {% endif %} diff --git a/spec/jekyll_seo_tag_spec.rb b/spec/jekyll_seo_tag_spec.rb index ada5b33..f2fafd2 100644 --- a/spec/jekyll_seo_tag_spec.rb +++ b/spec/jekyll_seo_tag_spec.rb @@ -39,7 +39,14 @@ describe Jekyll::SeoTag do expect(subject.render(context)).to match(//) end - it "uses the site description when no page description exists" do + it "uses the page excerpt when no page description exists" do + page = page({"description" => "foobar"}) + context = context({ :page => page }) + expect(subject.render(context)).to match(//) + expect(subject.render(context)).to match(//) + end + + it "uses the site description when no page description nor excerpt exist" do site = site({"description" => "foo"}) context = context({ :site => site }) expect(subject.render(context)).to match(//)