lib/jekyll-bits/picture.rb in jekyll-bits-0.13 vs lib/jekyll-bits/picture.rb in jekyll-bits-0.14
- old
+ new
@@ -30,11 +30,11 @@
# Jekyll module
module Jekyll
# All our custom filters
module JbFilters
def jb_picture_head(page)
- uri = uri(page)
+ uri = abs(uri(page))
return '' if uri.empty?
html = "<meta name='og:image' content='#{CGI.escapeElement(uri)}'/>"
html += "<meta name='twitter:image' content='#{CGI.escapeElement(uri)}'/>"
path = uri
path = File.join(Dir.pwd, path) unless \
@@ -95,9 +95,13 @@
uri = yaml['src'] if yaml['src']
else
uri = yaml
end
end
+ uri.to_s
+ end
+
+ def abs(uri)
unless uri.empty?
uri = URI.parse(uri)
uri = home + uri.to_s unless %w(http https).include?(uri.scheme)
end
uri.to_s