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(//)