Merge pull request #236 from DirtyF/meta-generator

Add meta generator
This commit is contained in:
Ben Balter 2017-09-06 10:27:31 -04:00 committed by GitHub
commit d230d6d885
3 changed files with 11 additions and 0 deletions

View File

@ -20,6 +20,10 @@ module Jekyll
Jekyll::SeoTag::VERSION
end
def jekyll_version
Jekyll::VERSION
end
# Should the `<title>` tag be generated for this page?
def title?
return false unless title

View File

@ -3,6 +3,8 @@
<title>{{ seo_tag.title }}</title>
{% endif %}
<meta name="generator" content="Jekyll v{{ seo_tag.jekyll_version }}" />
{% if seo_tag.page_title %}
<meta property="og:title" content="{{ seo_tag.page_title }}" />
{% endif %}

View File

@ -23,6 +23,10 @@ RSpec.describe Jekyll::SeoTag do
expect(output).to match(%r!Jekyll SEO tag v#{version}!i)
end
it "outputs meta generator" do
expect(output).to match(%r!Jekyll v#{Jekyll::VERSION}!i)
end
it "outputs valid HTML" do
site.process
options = {
@ -296,6 +300,7 @@ RSpec.describe Jekyll::SeoTag do
expected = <<-EOS
<!-- Begin Jekyll SEO tag v#{version} -->
<title>Foo</title>
<meta name="generator" content="Jekyll v#{Jekyll::VERSION}" />
<meta property="og:title" content="Foo" />
<meta property="og:locale" content="en_US" />
<link rel="canonical" href="http://example.invalid/page.html" />