Use baseurl to build seo_url

This commit is contained in:
Pat Hawks 2016-01-06 10:00:20 -08:00
parent eddff47cc3
commit fd06faf86c
No known key found for this signature in database
GPG Key ID: F1746FF5F18B3D1B
2 changed files with 10 additions and 1 deletions

View File

@ -1,7 +1,7 @@
<!-- Begin Jekyll SEO tag -->
{% if site.url %}
{% assign seo_url = site.url %}
{% assign seo_url = site.url | append: site.baseurl %}
{% elsif site.github.url %}
{% assign seo_url = site.github.url %}
{% endif %}

View File

@ -86,6 +86,15 @@ describe Jekyll::SeoTag do
expect(subject.render(context)).to match(expected)
end
it "uses baseurl to build the seo url" do
site = site({ "url" => "http://example.invalid", "baseurl" => "/foo" })
context = context({ :site => site })
expected = %r!<link rel="canonical" href="http://example.invalid/foo/page.html" itemprop="url" />!
expect(subject.render(context)).to match(expected)
expected = %r!<meta property='og:url' content='http://example.invalid/foo/page.html' />!
expect(subject.render(context)).to match(expected)
end
it "outputs the site title meta" do
site = site({"title" => "Foo", "url" => "http://example.invalid"})
context = context({ :site => site })