Correct template logic, resolve style issues

This commit is contained in:
Josh Habdas 2017-03-02 20:24:13 +08:00
parent 4eeb09a749
commit 51db5806c2
No known key found for this signature in database
GPG Key ID: BB7367EE9A70A631
2 changed files with 9 additions and 3 deletions

View File

@ -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 %}

View File

@ -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!<title>foo \| Site Description</title>!)
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!<title>Page Title \| Site Description</title>!)
end
end
end
context "with site.title" do