Merge pull request #57 from boturnbow/master

Update twitter:image to output full url
This commit is contained in:
Ben Balter 2016-02-23 18:27:56 -05:00
commit d233305d0f
3 changed files with 16 additions and 6 deletions

View File

@ -68,7 +68,7 @@ The SEO tag will respect any of the following if included in your site's `_confi
publisher: 1234
```
* `logo` - Relative URL to a site-wide logo (e.g., `assets/your-company-logo.png`)
* `logo` - Relative URL to a site-wide logo (e.g., `/assets/your-company-logo.png`)
* `social` - For [specifying social profiles](https://developers.google.com/structured-data/customize/social-profiles). The following properties are available:
* `type` - Either `person` or `organization` (defaults to `person`)
* `name` - If the user or organization name differs from the site's name
@ -79,7 +79,7 @@ The SEO tag will respect the following YAML front matter if included in a post,
* `title` - The title of the post, page, or document
* `description` - A short description of the page's content
* `image` - Relative URL to an image associated with the post, page, or document (e.g., `assets/page-pic.jpg`)
* `image` - Relative URL to an image associated with the post, page, or document (e.g., `/assets/page-pic.jpg`)
* `author` - Page-, post-, or document-specific author information (see below)
### Disabling `<title>` output

View File

@ -84,7 +84,7 @@
{% endif %}
{% if page.image %}
<meta property="og:image" content="{{ page.image | prepend: "/" | prepend: seo_url | escape }}" />
<meta property="og:image" content="{{ page.image | prepend: seo_url | escape }}" />
{% endif %}
{% if page.date %}
@ -118,7 +118,7 @@
<meta name="twitter:description" content="{{ seo_description }}" />
{% if page.image %}
<meta name="twitter:image" content="{{ page.image | escape }}" />
<meta name="twitter:image" content="{{ page.image | prepend: seo_url | escape }}" />
{% endif %}
{% if seo_author_twitter %}

View File

@ -111,10 +111,10 @@ describe Jekyll::SeoTag do
end
context 'with page.image' do
let(:page) { make_page('image' => 'foo.png') }
let(:page) { make_page('image' => '/img/foo.png') }
it 'outputs the image' do
expected = %r{<meta property="og:image" content="http://example.invalid/foo.png" />}
expected = %r{<meta property="og:image" content="http://example.invalid/img/foo.png" />}
expect(output).to match(expected)
end
end
@ -247,6 +247,16 @@ describe Jekyll::SeoTag do
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