Merge pull request #15 from pathawks/baseurl

Use baseurl to build seo_url
This commit is contained in:
Pat Hawks 2016-01-06 10:02:26 -08:00
commit 660249140d
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 })