使单页 Web 应用程序可被社交网络抓取 (Facebook/Twitter/reddit)

Make a single page webapplication crawlable for social networks (Facebook/Twitter/reddit)

我有一个用 Backbone 编写的单页 ​​Web 应用程序(后端是 Restful java api)。 我的问题很简单:我知道如何让我的网站可供 google 抓取 - 但不适用于社交网络。

在 FB 上尝试 link:http://eese.com/story/206875

它只会显示标准的元描述,而不是实际内容。

有没有办法让社交网络抓取我的网站? (希望它不要太宽泛——我想知道实现这个的一般概念)

对于 Facebook 链接,我建议确保您在页面的 <meta> 部分中有正确的 OpenGraph 标签,即:

<meta property="og:site_name" content="My Favorite News"/>

以下 Facebook 的 Best Practices you can customize the description and other things that are shown when the page is posted to Facebook. Twitter 和其他社交网络也使用类似的 OpenGraph 样式标签。

除了使用正确的 OpenGraph 标签外,您还需要能够提供静态版本的 SPA。

看看像 https://prerender.io/ 这样的预呈现解决方案,这将为爬虫呈现您网站的静态版本。