From 51db5806c20f3947936a009afca8ae4a6c6230c2 Mon Sep 17 00:00:00 2001 From: Josh Habdas Date: Thu, 2 Mar 2017 20:24:13 +0800 Subject: [PATCH] Correct template logic, resolve style issues --- lib/template.html | 2 +- spec/jekyll_seo_tag_spec.rb | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/template.html b/lib/template.html index e320aba..0d0aeb8 100755 --- a/lib/template.html +++ b/lib/template.html @@ -10,7 +10,7 @@ {% if page.title and seo_site_title %} {% assign seo_title = seo_title | append:" | " | append: seo_site_title %} -{% elsif site.description %} +{% elsif site.description and seo_site_title %} {% assign seo_title = seo_title | append:" | " | append: site.description %} {% endif %} diff --git a/spec/jekyll_seo_tag_spec.rb b/spec/jekyll_seo_tag_spec.rb index 07ee0ea..1937ab9 100755 --- a/spec/jekyll_seo_tag_spec.rb +++ b/spec/jekyll_seo_tag_spec.rb @@ -60,6 +60,14 @@ describe Jekyll::SeoTag do end end + context "with site.description" do + let(:site) { make_site("description" => "Site Description") } + + it "builds the title without the site description" do + expect(output).not_to match(%r!foo \| Site Description!) + end + end + context "with site.title and site.description" do let(:site) { make_site("title" => "Site Title", "description" => "Site Description") } @@ -82,9 +90,7 @@ describe Jekyll::SeoTag do it "does not build the title with the site description" do expect(output).not_to match(%r!Page Title \| Site Description!) end - end - end context "with site.title" do