简体   繁体   English

Facebook之类的按钮喜欢错误的网址

[英]Facebook like button is liking wrong url

First off, I saw similar posts already, but they weren't exactly what I am asking. 首先,我已经看到了类似的帖子,但它们并不是我所要的。

I used the Facebook Dev to create a like button for my website, stuck the code in and the the button showed up. 我使用Facebook开发人员为我的网站创建了一个“赞”按钮,将代码插入其中,然后该按钮显示出来。 The only issue is that it likes the wrong url when I click the button. 唯一的问题是,当我单击按钮时,它喜欢错误的网址。

I'm pretty sure the issue is that I have it set to redirect automatically from mydomain.com to the most recent post. 我很确定问题是我将其设置为自动从mydomain.com重定向到最新帖子。 I think this is gumming up the works with the like button and causing it to like mydomain.com/mostrecentpost instead of simply liking mydomain.com. 我认为这是通过点赞按钮使作品更加繁复,导致其喜欢mydomain.com/mostrecentpost而不是仅仅喜欢mydomain.com。

Is there a way to correct this issue without having to get rid of the redirect (because that isn't an option)? 有没有一种方法可以解决此问题而不必摆脱重定向(因为这不是一种选择)?

Sorry if that was a little wordy, wanted to make sure I explained the issue fully. 抱歉,如果有点罗word,想确保我已完全解释了该问题。

Is there a way to correct this issue without having to get rid of the redirect (because that isn't an option)? 有没有一种方法可以解决此问题而不必摆脱重定向(因为这不是一种选择)?

Either don't redirect in those cases where the user agent header of the request points to it being Facebook's scraper ; 在请求的用户代理标头指向它是Facebook的scraper的 情况下 ,不要重定向;

or set the canonical URL of http://example.com/mostrecentpost to just http://example.com/ using the appropriate Open Graph meta tag. 或一组规范网址http://example.com/mostrecentpost只是http://example.com/使用适当的Open Graph元标记。 (Although that would mean you would not be able to like a single post any more, because all of your posts would just point to your base domain as the “real” website; so the first is probably the better option.) (尽管那将意味着您将无法再喜欢一个帖子,因为您所有的帖子都只会指向您的基本域为“真实”网站;因此,第一个可能是更好的选择。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM