h5分享facebook详解

675 阅读1分钟

og协议介绍

OG协议(Open Graph Protocol)也叫开放内容协议,是一套制定的Metatags规格,也就是Meta Property=og标签,用来标注页面信息,例如网站页面的标题、类型、页面地址、缩略图、视频/音频等地址信息。

加og协议的好处

1.有利于正确的的分享您的内容到SNS网站

2.有利于您的内容更有效的的在SNS网站中传播

3.加强meta信息优化内容,有利于对于权重提升和排名

og标签的书写

协议规范 ogp.me

<!-- og:type 表示页面的类型,常用值:article、website、book、movie、music、news等 -->
<meta property="og:type" content="website">
<!-- og:title 页面的标题 -->
<meta property="og:title" content="WeParty - Voice Party Gaming">
<!-- og:description 页面的简单描述 -->
<meta property="og:url" content="https://wepartygame.com/room-share">
<!-- og:url 页面地址 -->
<meta property="og:description" content="Welcome to this mystery carnival, you are more than welcome to invite your friends to join. You will have assigned roles and missions and you will use your insight and wisdom to find out the Killer. If you are the Killer, remember to disguise and deceive, outplay those civilians." />
<!-- og:image 略缩图地址 -->
<!-- 为了在高分辨率设备上完美展示,建议使用宽度至少为 1080 像素的图像。您至少应该使用宽度为 600 像素的图像,以显示图像链接式广告。我们建议您在广告创意中使用 1:1 的图像 -->
<meta property="og:image" content="https://xx/xxx/1609829704247305.png"/>
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">

facebook分享

分享文档 developers.facebook.com/docs/javasc…

使用网址重定向分享

www.facebook.com/dialog/shar…? app_id=145634995501895 &display=popup &href=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2F &redirect_uri=https%3A%2F%2Fdevelopers.facebook.com%2Ftools%2Fexplorer

参数描述是否为必要项?
app_id应用的唯一标识符。是。
displaypage、popup分享对话框呈现方式。是。
hashtag要添加到分享内容中的话题标签。用户可以在分享对话框中删除此话题标签。话题标签中必须有 符号,例如 #facebook。默认值为 null。否。
href要分享的链接。默认值为当前网址。在使用 SDK 时为必要项。
redirect_uri用户点击分享对话框中的按钮后要重新定向到的网址。是。