Facebook Open Graph Error - Inferred Property

前端 未结 6 2270
渐次进展
渐次进展 2020-12-05 01:54

I\'m trying to implement Facebook\'s OpenGRaph protocol on my product pages.

On each page i have this above the head section:



        
相关标签:
6条回答
  • 2020-12-05 02:31

    In case it helps anyone I had the same error. It turns out my page had not been scrapped by Facebook in awhile and it was an old error. There was a scrape again button on the page that fixed it.

    0 讨论(0)
  • 2020-12-05 02:34

    You need a space after the final set of quote marks

    <meta property="og:url" content="http://www.mywebaddress.com"/>
    

    Should be..likes this one

    <meta property="og:url" content="http://www.mywebaddress.com" />
    
    0 讨论(0)
  • 2020-12-05 02:34

    UPD 2020: "Open Graph Object Debugger" has been discontinued. Use Sharing Debugger to refresh Facebook cache.


    There is some confusion about tons of Facebook Tools and Documentation. So many people probably use the Sharing Debugger tool to check their OpenGraph markup: https://developers.facebook.com/tools/debug/sharing/

    But it only retrieves the information about your site from the Facebook cache. This means that after you change the ogp-markup on your site, the Sharing Debugger will still be using the old cached data. Moreover, if there is no cached data on the Facebook server then the Sharing Debugger will show you the error: This URL hasn't been shared on Facebook before.

    So, the solution is to use another tool – Open Graph Object Debugger: https://developers.facebook.com/tools/debug/og/object/

    It allows you to Fetch new scrape information and refresh the Facebook cache:

    Honestly, I don't know how to find this tool exploring the Tools & Support section of developers.facebook.com – I cannot find any links and mentions. I only have this tool in my bookmarks. That's Facebook :)


    Use 'property'-attrs

    I also noted that some developers use the name attribute instead of property. Many parsers probably will process such tags properly, but according to The Open Graph protocol, we should use property, not name:

    <meta property="og:url" content="http://www.mywebaddress.com"/>
    

    Use full URLs

    The last recommendation is to specify full URLs. For example, Facebook complains when you use relative URL in og:image. So use the full one:

    <meta property="og:image" content="http://www.mywebaddress.com/myimage.jpg"/>
    
    0 讨论(0)
  • 2020-12-05 02:42

    In my case an unexpected error notice in the source code stopped the facebook crawler from parsing the (correctly set) og-meta tags.

    I was using the HTTP_ACCEPT_LANGUAGE header, which worked fine for regular browser requests but not for the crawler, as it obviously won't use/set it.

    Therefore, it was crucial for me to use the facebook's debugger feature See exactly what our scraper sees for your URL, as the error notice only could only be seen there (but not through the regular 'view source code'-browser feature).

    0 讨论(0)
  • 2020-12-05 02:43

    It might help some people who are struggling to get Facebook to read Open Graph nicely...

    Have a look at the source code that is generated by browser using Firefox, Chrome or another desktop browser (many mobiles won't do view source) and make sure there is no blank lines before the doctype line or head tag... If there is Facebook will have a complete tantrum and throw it's toys out of the pram! (Best description!) Remove Blank Line - happy Facebook... took me about 1.5 - 2 hours to spot this!

    0 讨论(0)
  • 2020-12-05 02:48

    Are those tags on 'http://www.mywebaddress.com'?

    Bear in mind the linter will follow the og:url tag as this tag should point to the canonical URL of the piece of content - so if you have a page, e.g. 'http://mywebaddress.com/article1' with an og:url tag pointing to 'http://mywebaddress.com', Facebook will go there and read the tags there also.

    Failing that, the most common reason i've seen for seemingly correct tags not being detected by the linter is user-agent detection returning different content to Facebook's crawler than the content you're seeing when you manually check

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