og:url is driving me crazy?

前端 未结 3 561
攒了一身酷
攒了一身酷 2020-12-23 14:17

hope you can help me...

I want to have a page with facebook metatags, like:




        
相关标签:
3条回答
  • 2020-12-23 14:32

    you can put the like button in an iframe. Furthermore, that iframe may or may not need to be filled by setting a src attribute. I would try adding the like button code as innerHTML, and then try a separate file to set the src to.

    It would look something like this:

    <iframe><place like code here></iframe>
    

    When that doesn't work, place the like code in a separate file, and set the src of the iframe to that file. Let me know if you have quesitons

    0 讨论(0)
  • 2020-12-23 14:42

    og:url basically tells the FB scraper "ignore anything on this page, and scrape this url instead" So it's doing exactly what it's supposed to do. If you want the like button to point to a different url, use the href parameter and have it point to a different url.

    See https://developers.facebook.com/docs/reference/plugins/like/ for more information.

    0 讨论(0)
  • 2020-12-23 14:54

    I think I understand what you are asking. Like @Jeff Sherlock said "og:url basically tells our scraper "ignore anything on this page, and scrape this url instead"..."

    So if og:url is anything other than the current page -- Facebook will try to scrape the open graph data from there instead.

    If this is a page you are trying to send people to if they click on the 'like object' that is posted to a users wall (who has already liked your page) --

    I made a tool for this exact purpose -- as I thought it might be helpful to others:

    Facebook/Open Graph Like button Generator

    It generates (and stores) the open graph tag(s) so you don't need to put them in your page at all and the 'Redirect URL' tells it where to send all the traffic.

    It detects the Facebook bot/scraper too so it won't interfere with anything :)

    Good luck

    0 讨论(0)
提交回复
热议问题