Incorporate feedback, add unit tests

This commit is contained in:
Josh Habdas 2017-01-13 12:37:53 +08:00
parent 0dea0333d2
commit a321a7f2f7
No known key found for this signature in database
GPG Key ID: BB7367EE9A70A631
3 changed files with 68 additions and 9 deletions

View File

@ -92,8 +92,15 @@ The SEO tag will respect any of the following if included in your site's `_confi
```
* `google_site_verification` for verifying ownership via Google webmaster tools
* `bing_site_verification` for verifying ownership via Bing webmaster tools
* `yandex_site_verification` for verifying ownership via Yandex webmaster tools
* Alternatively, verify ownership with several services at once using the following format:
```yml
webmaster_verifications:
google: 1234
bing: 1234
alexa: 1234
yandex: 1234
```
The SEO tag will respect the following YAML front matter if included in a post, page, or document:

View File

@ -172,15 +172,23 @@
{% endif %}
{% endif %}
{% if site.google_site_verification %}
{% if site.webmaster_verifications %}
{% if site.webmaster_verifications.google %}
<meta name="google-site-verification" content="{{ site.webmaster_verifications.google }}">
{% endif %}
{% if site.webmaster_verifications.bing %}
<meta name="msvalidate.01" content="{{ site.webmaster_verifications.bing }}">
{% endif %}
{% if site.webmaster_verifications.alexa %}
<meta name="alexaVerifyID" content="{{ site.webmaster_verifications.alexa }}">
{% endif %}
{% if site.webmaster_verifications.yandex %}
<meta name="yandex-verification" content="{{ site.webmaster_verifications.yandex }}">
{% endif %}
{% elsif site.google_site_verification %}
<meta name="google-site-verification" content="{{ site.google_site_verification }}" />
{% endif %}
{% if site.bing_site_verification %}
<meta name="msvalidate.01" content="{{ site.bing_site_verification }}">
{% endif %}
{% if site.yandex_site_verification %}
<meta name="yandex-verification" content="{{ site.yandex_site_verification }}">
{% endif %}
<script type="application/ld+json">
{

View File

@ -440,4 +440,48 @@ EOS
expect(output).to match(%r!<link rel="next" href="/bar">!)
end
end
context "webmaster verification" do
context "with site.webmaster_verifications" do
let(:site_verifications) do
{
"google" => "foo",
"bing" => "bar",
"alexa" => "baz",
"yandex" => "bat"
}
end
let(:site) { make_site("webmaster_verifications" => site_verifications) }
it "outputs google verification meta" do
expected = %r!<meta name="google-site-verification" content="foo">!
expect(output).to match(expected)
end
it "outputs bing verification meta" do
expected = %r!<meta name="msvalidate.01" content="bar">!
expect(output).to match(expected)
end
it "outputs alexa verification meta" do
expected = %r!<meta name="alexaVerifyID" content="baz">!
expect(output).to match(expected)
end
it "outputs yandex verification meta" do
expected = %r!<meta name="yandex-verification" content="bat">!
expect(output).to match(expected)
end
end
context "with site.google_site_verification" do
let(:site) { make_site("google_site_verification" => "foo") }
it "outputs google verification meta" do
expected = %r!<meta name="google-site-verification" content="foo" />!
expect(output).to match(expected)
end
end
end
end