This commit is contained in:
BoHung Chiu 2022-10-24 17:52:02 +08:00
parent d60851d28c
commit 8b71e8e54f
1 changed files with 2 additions and 1 deletions

View File

@ -1,4 +1,5 @@
class PageContentsController < OrbitAdminController
require 'uri'
def index
params = OrbitHelper.params
if params["wiki"].present?
@ -20,7 +21,7 @@ class PageContentsController < OrbitAdminController
img_srcs = doc.css('img').map{ |i| i['src'] }
metas = [{"property" => "og:title", "content" => name},{"property" => "og:site_name", "content" => Site.first.title},{"property" => "og:url", "content" => request.original_url},{"property" => "og:description", "content" => meta_desc},{"property" => "og:type", "content" => "Article"}]
if img_srcs.count > 0
metas << {"property" => "og:image", "content" => "#{request.base_url}#{img_srcs[0]}"}
metas << {"property" => "og:image", "content" => URI.join(request.base_url, img_srcs[0])}
end
OrbitHelper.render_meta_tags(metas)