单页应用程序和打开图 [英] Single Page Applications and Open Graph

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

问题描述

我正在写一个使用下划线模板的SPA.该应用程序搜索音乐专辑并为其评分,然后通过ajax返回结果.如果Facebook开放图元标记不能动态更改,并且无论搜索结果如何页面的网址都是恒定的,那么我该如何做到这一点,以便用户可以分享他们对某个专辑的评价.

I'm writing a SPA that uses underscore templating. The app searches for and rates music albums and returns the result via ajax. If facebook open graph metatags cannot be altered dynamically and the url of the page is constant regardless of search result, how can i make it so users can share that they rated a certain album.

即)

<meta property="fb:app_id"      content="118454308341351" /> 
<meta property="og:url"         content="http://www.appurl.com" /> 
<meta property="og:title"       content="Fleetwood Mac's Rumors" /> 
<meta property="og:image"       content="AppImg.jpg" /> 

并更新这些属性以反映给定的搜索结果.

and update those properties to reflect a given search result.

推荐答案

我处理此问题的方法是创建一个动态页面,将其用作打开的图形对象,该页面仅由url参数填充并重定向回我的使用元重定向的SPA.

The way I handle this is to create a dynamic page which I use as my open graph object, which is simply populated from the url parameters and redirects back to my SPA using the meta redirect.

<元http-equiv =刷新" content ="0; URL = http://YOUR_WEBSITE_WITH_DYNAMIC_CONTENT">

这篇关于单页应用程序和打开图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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