Facebook 'Like' buttons and # URL strings?

前端 未结 3 616
遇见更好的自我
遇见更好的自我 2020-12-29 13:40

What does Facebook make of \'Like\' buttons in a ajax web app if they are referring to the same page but with a different # string?

Does it treat them as different p

3条回答
  •  天涯浪人
    2020-12-29 13:54

    Facebook's like buttons use metadata that are embedded in the HTML markup of a single page. It would work in theory if your URL's produce different metadata when accessed by curl (i.e. without JavaScript, which I believe is not possible since the hash portion is not seen server-side, so there is no way to act on hash string values server side).

    So having said that, I would assume that Facebook Like buttons don't behave differently for different hash strings. A look at the facebook documentation (which mostly sucks) doesnt mention this, but the facebook developer forums seem to confirm this: http://forum.developers.facebook.com/viewtopic.php?pid=240151

    However, all is not lost. You can specify the URL of a like button, so just set the URL to be the SEO-friendly URL of the same page: http://developers.facebook.com/docs/reference/plugins/like

    UPDATE - Clarifying from the comments

    So, now that we know you have static versions of the hash string URLS. Before, you were most likely placing like buttons on the page with this code:

    XFBML:

    
    

    Instead, you should be specifying the SEO version of the URL. For example, when you're on mysite.com/articles#story4, the code should look like:

    XFBML:

    
    

提交回复
热议问题