Fix bug.
This commit is contained in:
parent
7608bab38f
commit
acfd3b7fce
|
@ -18,7 +18,7 @@ class PageContentsController < OrbitAdminController
|
||||||
request = OrbitHelper.request
|
request = OrbitHelper.request
|
||||||
meta_desc = html.nil? ? "" : ActionView::Base.full_sanitizer.sanitize(html)[0..200]
|
meta_desc = html.nil? ? "" : ActionView::Base.full_sanitizer.sanitize(html)[0..200]
|
||||||
doc = Nokogiri::HTML( html )
|
doc = Nokogiri::HTML( html )
|
||||||
img_srcs = doc.css('img').map{ |i| i['src'] }
|
img_srcs = doc.css('img').map{ |i| i['src'] }.compact
|
||||||
metas = [{"property" => "og:description", "content" => meta_desc},{"property" => "og:type", "content" => "Article"}]
|
metas = [{"property" => "og:description", "content" => meta_desc},{"property" => "og:type", "content" => "Article"}]
|
||||||
if img_srcs.count > 0
|
if img_srcs.count > 0
|
||||||
metas << {"property" => "og:image", "content" => URI.join(request.base_url, URI.encode(img_srcs[0])).to_s}
|
metas << {"property" => "og:image", "content" => URI.join(request.base_url, URI.encode(img_srcs[0])).to_s}
|
||||||
|
|
Loading…
Reference in New Issue