Facebook的Open Graph的单页应用程序 [英] Facebook Open Graph Single Page Apps
问题描述
我已经建立了使用骨干JS单页的应用程序。我有不同的应用程序状态和动态内容(例如书籍)单独骨干网的网址路线,但本质上Facebook将永远只能看到索引页面
I have built a single page application using backbone js. I have separate backbone url "routes" for various application states and dynamic content (e.g. books), but essentially Facebook will only ever see the index page.
下面的SO问题似乎提供了一个有趣的方法来提供动态内容的物理开放图形网址:
The following SO question seems to provide an interesting approach to providing physical open graph URLs for dynamic content:
<一个href=\"http://stackoverflow.com/questions/7656151/multiple-facebook-opengraph-objects-on-the-same-page\">Multiple在同一页面 Facebook的opengraph对象
Multiple Facebook opengraph objects on the same page
如何有其他开发动态网页使用开放图形标签接近,特别是在单页的应用程序?
How have other developers approached using open graph tags on dynamic pages, specifically in single page apps?
推荐答案
您就能得到这个服务器输出动态内容,但你仍然需要一个不同的URL为每个对象,因为这是指数如何Facebook的这些对象。
You can have the server output dynamic content for this, but you still need a different url for each object since this is how facebook index those objects.
但是你可以做什么,是使用的URL查询字符串或片段部分来标识它。
所以,让我们说你有,你要为所有打开的图形对象的单页: your-domain.com/og 的,现在你可以给它添加标识符是这样的:
What you can do however, is use the querystring or fragment parts of the url to identify it. So, let's say you have a single page that you want to serve all the open graph objects: your-domain.com/og now you can add to it identifiers like this:
your-domain.com/og?type=3&id=432543643
your-domain.com/og#type=653&id=46t43g3
your-domain.com/og?type=25id=4tn4g43#anotherstring
这篇关于Facebook的Open Graph的单页应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!