Skip to content

Commit 6602491

Browse files
committed
Merge pull request #15 from pathawks/baseurl
Use baseurl to build seo_url
2 parents eddff47 + fd06faf commit 6602491

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!-- Begin Jekyll SEO tag -->
22

33
{% if site.url %}
4-
{% assign seo_url = site.url %}
4+
{% assign seo_url = site.url | append: site.baseurl %}
55
{% elsif site.github.url %}
66
{% assign seo_url = site.github.url %}
77
{% endif %}

spec/jekyll_seo_tag_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@
8686
expect(subject.render(context)).to match(expected)
8787
end
8888

89+
it "uses baseurl to build the seo url" do
90+
site = site({ "url" => "http://example.invalid", "baseurl" => "/foo" })
91+
context = context({ :site => site })
92+
expected = %r!<link rel="canonical" href="http://example.invalid/foo/page.html" itemprop="url" />!
93+
expect(subject.render(context)).to match(expected)
94+
expected = %r!<meta property='og:url' content='http://example.invalid/foo/page.html' />!
95+
expect(subject.render(context)).to match(expected)
96+
end
97+
8998
it "outputs the site title meta" do
9099
site = site({"title" => "Foo", "url" => "http://example.invalid"})
91100
context = context({ :site => site })

0 commit comments

Comments
 (0)