Merge branch 'master' into master

This commit is contained in:
Bo Turnbow 2016-03-02 15:50:51 -07:00
commit 54effa1abd
4 changed files with 26 additions and 41 deletions

View File

@ -42,7 +42,7 @@ Jekyll SEO tag isn't designed to accommodate every possible use case. It should
3. Add the following right before `</head>` in your site's template(s):
```liquid
{% seo %}
{% seo %}
```
## Usage
@ -60,12 +60,12 @@ The SEO tag will respect any of the following if included in your site's `_confi
username: benbalter
```
* `facebook:app_id` (A Facebook app ID for Facebook insights), and/or `facebook:publisher` (A Facebook page URL or ID of the publishing entity). You'll want to describe one or both like so:
* `facebook:app_id` (a Facebook app ID for Facebook insights), and/or `facebook:publisher` (a Facebook page URL or ID of the publishing entity). You'll want to describe one or both like so:
```yml
facebook:
app_id: 1234
publisher: 1234
facebook:
app_id: 1234
publisher: 1234
```
* `logo` - Relative URL to a site-wide logo (e.g., `/assets/your-company-logo.png`)

View File

@ -3,6 +3,6 @@ module Liquid; class Tag; end; end
module Jekyll
class SeoTag < Liquid::Tag
VERSION = '1.3.1'.freeze
VERSION = '1.3.2'.freeze
end
end

View File

@ -88,18 +88,18 @@
<title>{{ seo_title }}</title>
{% endif %}
{% if seo_title %}
{% if seo_page_title %}
<meta property="og:title" content="{{ seo_page_title }}" />
{% endif %}
{% if seo_description %}
<meta name="description" content="{{ seo_description }}" />
<meta property='og:description' content="{{ seo_description }}" />
<meta property="og:description" content="{{ seo_description }}" />
{% endif %}
{% if seo_url %}
<link rel="canonical" href="{{ page.url | prepend: seo_url | replace:'/index.html','/' }}" />
<meta property='og:url' content='{{ page.url | prepend: seo_url | replace:'/index.html','/' }}' />
<meta property="og:url" content="{{ page.url | prepend: seo_url | replace:'/index.html','/' }}" />
{% endif %}
{% if seo_site_title %}
@ -126,12 +126,6 @@
{% if site.twitter %}
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@{{ site.twitter.username | replace:"@","" }}" />
<meta name="twitter:title" content="{{ seo_title }}" />
<meta name="twitter:description" content="{{ seo_description }}" />
{% if page.image %}
<meta name="twitter:image" content="{{ page.image | prepend: seo_url | escape }}" />
{% endif %}
{% if seo_author_twitter %}
<meta name="twitter:creator" content="@{{ seo_author_twitter }}" />
@ -154,14 +148,14 @@
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@context": "http://schema.org",
{% if seo_type %}
"@type" : {{ seo_type | jsonify }},
"@type": {{ seo_type | jsonify }},
{% endif %}
{% if seo_name %}
"name" : {{ seo_name | jsonify }},
"name": {{ seo_name | jsonify }},
{% endif %}
{% if seo_page_title %}
@ -185,10 +179,10 @@
{% endif %}
{% if seo_links %}
"sameAs" : {{ seo_links | jsonify }},
"sameAs": {{ seo_links | jsonify }},
{% endif %}
"url" : "{{ page.url | prepend: seo_url | replace:'/index.html','/' }}"
"url": {{ page.url | prepend: seo_url | replace:'/index.html','/' | jsonify }}
}
</script>

View File

@ -55,7 +55,7 @@ describe Jekyll::SeoTag do
it 'uses the page description' do
expect(output).to match(%r{<meta name="description" content="foo" />})
expect(output).to match(%r{<meta property='og:description' content="foo" />})
expect(output).to match(%r{<meta property="og:description" content="foo" />})
end
end
@ -64,7 +64,7 @@ describe Jekyll::SeoTag do
it 'uses the page excerpt when no page description exists' do
expect(output).to match(%r{<meta name="description" content="foo" />})
expect(output).to match(%r{<meta property='og:description' content="foo" />})
expect(output).to match(%r{<meta property="og:description" content="foo" />})
end
end
@ -73,7 +73,7 @@ describe Jekyll::SeoTag do
it 'uses the site description when no page description nor excerpt exist' do
expect(output).to match(%r{<meta name="description" content="foo" />})
expect(output).to match(%r{<meta property='og:description' content="foo" />})
expect(output).to match(%r{<meta property="og:description" content="foo" />})
end
end
@ -83,7 +83,7 @@ describe Jekyll::SeoTag do
it 'uses the site url to build the seo url' do
expected = %r{<link rel="canonical" href="http://example.invalid/page.html" />}
expect(output).to match(expected)
expected = %r{<meta property='og:url' content='http://example.invalid/page.html' />}
expected = %r{<meta property="og:url" content="http://example.invalid/page.html" />}
expect(output).to match(expected)
end
@ -94,7 +94,7 @@ describe Jekyll::SeoTag do
expected = %r{<link rel="canonical" href="http://example.invalid/page/" />}
expect(output).to match(expected)
expected = %r{<meta property='og:url' content='http://example.invalid/page/' />}
expected = %r{<meta property="og:url" content="http://example.invalid/page/" />}
expect(output).to match(expected)
end
end
@ -105,7 +105,7 @@ describe Jekyll::SeoTag do
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)
expected = %r{<meta property='og:url' content='http://example.invalid/foo/page.html' />}
expected = %r{<meta property="og:url" content="http://example.invalid/foo/page.html" />}
expect(output).to match(expected)
end
end
@ -135,12 +135,13 @@ describe Jekyll::SeoTag do
end
it 'minifies the output' do
version = Jekyll::SeoTag::VERSION
expected = <<-EOS
<!-- Begin Jekyll SEO tag v1.3.1 -->
<!-- Begin Jekyll SEO tag v#{version} -->
<title>Foo</title>
<meta property="og:title" content="Foo" />
<link rel="canonical" href="http://example.invalid/page.html" />
<meta property='og:url' content='http://example.invalid/page.html' />
<meta property="og:url" content="http://example.invalid/page.html" />
<meta property="og:site_name" content="Foo" />
EOS
expect(output).to match(expected)
@ -155,7 +156,7 @@ EOS
it 'uses site.github.url to build the seo url' do
expected = %r{<link rel="canonical" href="http://example.invalid/page.html" \/>}
expect(output).to match(expected)
expected = %r{<meta property='og:url' content='http://example.invalid/page.html' />}
expected = %r{<meta property="og:url" content="http://example.invalid/page.html" />}
expect(output).to match(expected)
end
end
@ -184,8 +185,8 @@ EOS
it 'minifies JSON-LD' do
expected = <<-EOS
{
"@context" : "http://schema.org",
"@type" : "BlogPosting",
"@context": "http://schema.org",
"@type": "BlogPosting",
"headline": "post",
EOS
expect(output).to match(expected)
@ -267,16 +268,6 @@ EOS
expect(output).to match(expected)
end
end
context 'with page.image' do
let(:site) { make_site('twitter' => site_twitter, 'url' => 'http://example.invalid') }
let(:page) { make_page('image' => '/img/foo.png') }
it 'outputs the image' do
expected = %r{<meta name="twitter:image" content="http://example.invalid/img/foo.png" />}
expect(output).to match(expected)
end
end
end
end