diff --git a/lib/jekyll-seo-tag.rb b/lib/jekyll-seo-tag.rb index 69561dc..b89f242 100644 --- a/lib/jekyll-seo-tag.rb +++ b/lib/jekyll-seo-tag.rb @@ -21,7 +21,7 @@ module Jekyll def options { 'version' => VERSION, - "title" => !(@text =~ /title\s*:\s*false/i) + 'title' => title? } end @@ -33,6 +33,10 @@ module Jekyll } end + def title? + !(@text =~ /title=false/i) + end + def info { registers: context.registers, diff --git a/spec/jekyll_seo_tag_spec.rb b/spec/jekyll_seo_tag_spec.rb index 62d1817..1753804 100644 --- a/spec/jekyll_seo_tag_spec.rb +++ b/spec/jekyll_seo_tag_spec.rb @@ -1,15 +1,14 @@ require 'spec_helper' describe Jekyll::SeoTag do -# subject { Jekyll::SeoTag.parse('seo', nil, nil, nil) } - let(:page) { make_page } - let(:site) { make_site } - let(:post) { make_post } - let(:context) { make_context(page: page, site: site) } - let(:tag) { 'seo' } - let(:text) { '' } - let(:output) { Liquid::Template.parse("{% #{tag} #{text} %}").render!(context, {}) } - let(:json) { output.match(%r{}m)[1] } + let(:page) { make_page } + let(:site) { make_site } + let(:post) { make_post } + let(:context) { make_context(page: page, site: site) } + let(:tag) { 'seo' } + let(:text) { '' } + let(:output) { Liquid::Template.parse("{% #{tag} #{text} %}").render!(context, {}) } + let(:json) { output.match(%r{}m)[1] } let(:json_data) { JSON.parse(json) } before do @@ -102,6 +101,7 @@ describe Jekyll::SeoTag do context 'with site.baseurl' do let(:site) { make_site('url' => 'http://example.invalid', 'baseurl' => '/foo') } + it 'uses baseurl to build the seo url' do expected = %r{} expect(output).to match(expected) @@ -281,15 +281,13 @@ describe Jekyll::SeoTag do end context 'with title=false' do - it "does not output a