Files
kazoottt-blog/src/content/post/编程/前端/其他/open graph 简述.md
2024-12-02 03:09:01 +00:00

3.1 KiB
Raw Blame History

title, date, author, tags, finished, published, slug, description, NotionID-notionnext, link-notionnext, rinId, category, toAstro
title date author tags finished published slug description NotionID-notionnext link-notionnext rinId category toAstro
open graph简述 2024-04-09 KazooTTT
true true open-graph 在使用Twitter时我们可能会注意到有些链接会显示预览卡片而有些则不会。这主要是因为一些网站设置了Open Graph协议而有些则没有。Open Graph是由Facebook在2010年推出的协议用于在社交网络上分享链接时显示预览卡片。此外Twitter也有自己的Twitter Card协议如果两者同时存在Twitter会优先显示Twitter Card的内容。文章还介绍了一些检查和预览Open Graph设置的工具以及提供Open Graph示例的网站。 76ed52a0-ad58-401c-8a5d-c5719f67b673 https://kazoottt.notion.site/open-graph-76ed52a0ad58401c8a5dc5719f67b673 16 编程-前端-其他 true

Open Graph 简述

场景

在我们使用twitter的时候会发现有的链接会显示预览卡片有的不会。

Pasted image 20240409203435

Pasted image 20240409204440

这是因为有的网站设置了open graph有的没有。

Pasted image 20240409103122

那么什么是open graph

open graph是一个由facebook在2010年发布的协议用于在社交网络上分享链接时显示预览卡片。

Pasted image 20240409204654

我觉得无论是它的名称还是意图都能看出facebook以及其他支持这种协议的社交平台的开放性, 特别是在某些平台会屏蔽外链或者限流带有外链的衬托下。

Pasted image 20240409205145

和open graph类似还有twitter自己的card如果twitter card和open graph同时存在的话会先显示在twitter card。如果twitter card没有定义才会显示open graph。

Pasted image 20240409213244

Pasted image 20240408163056

预览和检查工具

OpenGraph - Preview Social Media Share and Generate Metatags - OpenGraph

Pasted image 20240409201933

OpenGraph - Preview Images and Generate Open Graph Meta Tags

Pasted image 20240409195616

Pasted image 20240409131420

一些例子

Open Graph Examples

Pasted image 20240409131603