문제

I have a website that is created using BackboneJS and I am trying to implement Facebook OG so that when user pastes my site's URL from the Facebook status, it will display the title, images and etc.

My problem is that the FB scraper is getting redirected always to the index page due that Apache redirects all traffic to the index page so BB router can work properly. It only sees the og title, og image and etc that was for the index page and not on my other page.

Facebook scraper/crawler does not seem to be going through the BB router. It just renders the static index.html page.

Has anyone got a workaround/solution for this one?

도움이 되었습니까?

해결책

You can use Facebook Lint tool to debug OG objects, here it is on one of your domain links:

http://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fembedible.com%2Fvideo%2FamQ1Njg4QGdtYWlsLmNvbTI5OA%3D%3D

Notice that you have a problem with the og:url that shows http://embedible.com/ although your OG object url is actually http://embedible.com/video/amQ1Njg4QGdtYWlsLmNvbTI5OA==

you can see it on the Redirect Path section of the lint debugger, the actual url that was scrapped is http://embedible.com/

On my website we render the same html template with different data based on the url. So I have 2 template engines one for real views on the client and one on the server that fill the meta tags

Bottom line: you must replace the meta tags on your Server.

다른 팁

I would suggest configuring the Facebook Open Graph tags in you're websites HTML itself (not Backbone). FB has special tags that it uses to generate the little previews. Here are the docs.

The Facebook scraper/crawler is not going through the backbone routes probably because it doesn't run javascript.

Since it doesn't run JS, you could set up a script to read the request uri when pages hit index.html, then redirect to a page with the appropriate OG tags.

CamelBlues, I don't think this is the solution I am looking for. Firstly, I am already using OG tags on my site. Secondly, I don't think crawler needs to know how to read JS but the page that JS renders depending on the URI... this is how the Backbone.js router works. And,

"Since it doesn't run JS, you could set up a script to read the request uri when pages hit index.html, then redirect to a page with the appropriate OG tags."

this is what the BB router is doing already and my pages have the appropriate OG tags. :(

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top