Change the way the orig_url is passed to fb
This commit is contained in:
parent
fc560f4205
commit
f7e6703d5f
|
@ -9,7 +9,7 @@ window.SocialShareButton =
|
||||||
img = encodeURIComponent($(el).parent().data("img"))
|
img = encodeURIComponent($(el).parent().data("img"))
|
||||||
fb_url = encodeURIComponent($(el).parent().data("fb_url"))
|
fb_url = encodeURIComponent($(el).parent().data("fb_url"))
|
||||||
url = encodeURIComponent(location.href)
|
url = encodeURIComponent(location.href)
|
||||||
fb_full_url = encodeURIComponent("#{fb_url}?orig_url=#{location.href}")
|
fb_full_url = encodeURIComponent("#{fb_url}?orig_host=#{location.host}&orig_path=#{location.pathname}")
|
||||||
switch site
|
switch site
|
||||||
when "weibo"
|
when "weibo"
|
||||||
SocialShareButton.openUrl("http://v.t.sina.com.cn/share/share.php?url=#{url}&pic=#{img}&title=#{title}&content=utf-8")
|
SocialShareButton.openUrl("http://v.t.sina.com.cn/share/share.php?url=#{url}&pic=#{img}&title=#{title}&content=utf-8")
|
||||||
|
|
|
@ -110,7 +110,7 @@ class ApplicationController < ActionController::Base
|
||||||
def render_share
|
def render_share
|
||||||
object_class = params[:model].classify.constantize
|
object_class = params[:model].classify.constantize
|
||||||
@object = object_class.find(params[:id])
|
@object = object_class.find(params[:id])
|
||||||
@orig_url = params[:orig_url]
|
@orig_url = "http://#{params[:orig_host]}/#{params[:orig_path]}"
|
||||||
render 'shared/render_share', :layout => false
|
render 'shared/render_share', :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta property="og:title" content="<%= @object.title %>" />
|
<meta property="og:title" content="<%= @object.title %>" />
|
||||||
<meta property="og:description" content="<%= @object.subtitle %>" />
|
<meta property="og:description" content="<%= strip_tags @object.subtitle %>" />
|
||||||
<meta property="og:url" content="<%= @orig_url %>" />
|
<meta property="og:url" content="<%= @orig_url %>" />
|
||||||
<meta property="og:image" content="<%= 'http://' + request.env['HTTP_HOST'] + @object.image.url %>" />
|
<meta property="og:image" content="<%= 'http://' + request.env['HTTP_HOST'] + @object.image.url %>" />
|
||||||
</head>
|
</head>
|
||||||
|
|
Reference in New Issue