From 244802ed89628fe3bf91bc2f5ee96b6171b94463 Mon Sep 17 00:00:00 2001 From: Bo Turnbow Date: Wed, 3 Feb 2016 10:17:04 -0700 Subject: [PATCH] Make page.image url relative to site rather than absolute --- README.md | 2 +- lib/template.html | 2 +- spec/jekyll_seo_tag_spec.rb | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c4ee3b3..75f5f65 100644 --- a/README.md +++ b/README.md @@ -69,5 +69,5 @@ 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` - The absolute URL to an image that should be associated with the post, page, or document +* `image` - Relative URL to an image associated with the post, page, or document (e.g., `assets/page-pic.jpg`) * `author` - The username of the post, page, or document author diff --git a/lib/template.html b/lib/template.html index 838fdda..4a5db80 100644 --- a/lib/template.html +++ b/lib/template.html @@ -94,7 +94,7 @@ {% endif %} {% if page.image %} - + {% endif %} {% if page.date %} diff --git a/spec/jekyll_seo_tag_spec.rb b/spec/jekyll_seo_tag_spec.rb index d420368..0f21722 100644 --- a/spec/jekyll_seo_tag_spec.rb +++ b/spec/jekyll_seo_tag_spec.rb @@ -153,9 +153,10 @@ describe Jekyll::SeoTag do end it "outputs the image" do - page = page({"image" => "http://foo.invalid/foo.png"}) - context = context({ :page => page }) - expected = // + page = page({ "image" => "foo.png" }) + site = site({ "url" => "http://example.invalid" }) + context = context({ :page => page, :site => site }) + expected = %r!! expect(subject.render(context)).to match(expected) end