Facebook的网站URL的按钮 [英] site URL for the facebook like button

查看:100
本文介绍了Facebook的网站URL的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Facebook的按钮问题。我想要用户个人资料上的注释看起来像这样:用户喜欢网站



网站的网址是 http://www.example.com/myapp/ ,网页网址是 http://www.example.com/myapp/page.html



我添加了< meta property =og:site_namecontent =.../> 在任何页面中,并使用< iframe> 添加相似的按钮。





我知道有一个解决方案来指定规范的URL,但是对于用户喜欢的页面,不是网站(也就是通过在标题上使用 og:url )。有人知道您如何指定网站的网址?它以某种方式自动指向域名,这在我的情况下是错误的,因为我需要' http://www.example.com/myapp/ ',而不是'code> http://www.example.com 。



我想要以下结果:用户喜欢' http://www.example.com/ myapp / page.html 'on' http://www.example.com/myapp ',而不是用户喜欢' http://www.example.com/myapp/page.html ' ' http://www.example.com '。



解决方案

我们遇到类似的问题,代替了一个 og:site_url 标签不得不有点黑客。我们的解决方案是将我们的基本URL( http://www.example.com 在您的示例中)重定向到FB页面。



当我们添加更多FB页面时,我们需要多个子域名来支持这一点,所以它不是真正可持续的,但可能至少暂时解决您的问题。


I have a problem with the Facebook like button. I want the note on user's profile to look something like this: 'User likes page on site'.

Site's URL it suppose to be 'http://www.example.com/myapp/' and the page URL it's 'http://www.example.com/myapp/page.html'.

I added <meta property="og:site_name" content="..."/> in the of any page and added the like button using <iframe>.

I know that there's a solution to specify the canonical URL, but for the page that user likes, not for the site (that is by using og:url on the header). Does anyone know how you can specify the site's URL? It somehow automatically points to the domain name, which it's wrong in my case because i need 'http://www.example.com/myapp/', not 'http://www.example.com'.

I want the following result: User likes 'http://www.example.com/myapp/page.html' on 'http://www.example.com/myapp', not User likes 'http://www.example.com/myapp/page.html' on 'http://www.example.com'.

Thank you very much for a possible answer.

解决方案

We've been running into similar problems and in lieu of a og:site_url tag have had to get a little hacky. Our solution is to have our base URL (http://www.example.com in your example) redirect to the FB page.

As we add more FB pages, we'll need multiple subdomains to support this, so it's not really sustainable, but may solve your problem at least temporarily.

这篇关于Facebook的网站URL的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆