Facebook打开图表单页应用程序 [英] Facebook Open Graph Single Page Apps

查看:170
本文介绍了Facebook打开图表单页应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用骨干js构建了一个单一的页面应用程序。我有不同的应用程序状态和动态内容(例如书籍)的单独的骨干网路由路线,但实际上Facebook只会看到索引页。



以下SO问题似乎提供了一种有趣的方法来为动态内容提供物理开放图形网址:



同一页上的多个Facebook开放对象



其他开发人员如何使用开放图表

解决方案

您可以让服务器输出动态内容,但您仍然可以需要一个不同的url为每个对象,因为这是Facebook如何索引这些对象。



然而,你可以做的是使用url的querystring或片段部分来识别它。
所以,假设你有一个页面,你想要提供所有的打开的图形对象: your-domain.com/og 现在你可以添加到这样的标识符: p>

  your-domain.com/og?type=3&id=432543643 
your-domain.com/og#type = 653& id = 46t43g3
your-domain.com/og?type=25id=4tn4g43#anotherstring


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.

The following SO question seems to provide an interesting approach to providing physical open graph URLs for dynamic content:

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?

解决方案

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.

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打开图表单页应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆