简体   繁体   English

Facebook Open Graph单页应用程序

[英]Facebook Open Graph Single Page Apps

I have built a single page application using backbone js. 我使用骨干js构建了一个单页面应用程序。 I have separate backbone url "routes" for various application states and dynamic content (eg books), but essentially Facebook will only ever see the index page. 对于各种应用程序状态和动态内容(例如书籍),我有单独的主干网址“路由”,但基本上Facebook只会看到索引页面。

The following SO question seems to provide an interesting approach to providing physical open graph URLs for dynamic content: 以下SO问题似乎提供了一种有趣的方法来为动态内容提供物理开放图形URL:

Multiple Facebook opengraph objects on the same page 同一页面上有多个Facebook opengraph对象

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. 您可以让服务器输出动态内容,但是每个对象仍然需要一个不同的URL,因为这是facebook索引这些对象的方式。

What you can do however, is use the querystring or fragment parts of the url to identify it. 但是,您可以使用URL的查询字符串或片段部分来识别它。 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现在可以添加如下标识符:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM