use title=false, not title: false
This commit is contained in:
parent
6bc8a57315
commit
81be1da466
|
@ -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,
|
||||
|
|
|
@ -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{<script type=\"application/ld\+json\">(.*)</script>}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{<script type=\"application/ld\+json\">(.*)</script>}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{<link rel="canonical" href="http://example.invalid/foo/page.html" />}
|
||||
expect(output).to match(expected)
|
||||
|
@ -281,15 +281,13 @@ describe Jekyll::SeoTag do
|
|||
end
|
||||
|
||||
context 'with title=false' do
|
||||
it "does not output a <title> tag if title:false" do
|
||||
site = site({"name" => "Site Name", "title" => "Site Title" })
|
||||
context = context({ :site => site })
|
||||
expected = %r!<title>!
|
||||
expect(output).not_to match(expected)
|
||||
let(:text) { 'title=false' }
|
||||
|
||||
it 'does not output a <title> tag' do
|
||||
expect(output).not_to match(/<title>/)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
it 'outputs valid HTML' do
|
||||
site.process
|
||||
options = {
|
||||
|
|
Loading…
Reference in New Issue