ogp prefix 怎么写

官网的内容不好理解,我大概整理了一遍

my_namespace (类型)

  • Music
  • Video
  • Article
  • Book
  • Profile
  • Website (默认)

URL

 

当要使用类型时,需要一个 prefix

官网的 best practices 是写在 html 或者 head

<html prefix="og: https://ogp.me/ns#">

 

facebook best practice

<head prefix=
    "og: http://ogp.me/ns# 
     fb: http://ogp.me/ns/fb# 
     product: http://ogp.me/ns/product#">
    <meta property="og:type"                   content="og:product" />
    <meta property="og:title"                  content="Friend Smash Coin" />
    <meta property="og:image"                  content="http://www.friendsmash.com/images/coin_600.png" />
    <meta property="og:description"            content="Friend Smash Coins to purchase upgrades and items!" />
    <meta property="og:url"                    content="http://www.friendsmash.com/og/coins.html" />
    <meta property="product:plural_title"      content="Friend Smash Coins" />
  </head>

 

 

 

看到 xml... 就大概猜是 XHTML 的规范,希望猜的对。

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#">

 

image_src 看样子是早期的产物,官网也没有说这个废弃,可能是太久了吧

<link rel="image_src" href="https://www.your-website.com/open-graph.jpg">

 

Best practice

<html prefix="og: https://ogp.me/ns#">
<head>
<title>The Rock (1996)</title>
<meta property="og:title" content="The Rock" />
<meta property="og:type" content="video.movie" />
<meta property="og:url" content="https://www.imdb.com/title/tt0117500/" />
<meta property="og:image" content="https://ia.media-imdb.com/images/rock.jpg" />
...
</head>
...
</html>

 

 

工具

 

大致上就是这样。

 

Links

posted @ 2021-08-27 22:50  泉油  阅读(175)  评论(0编辑  收藏  举报
Web Design Johor Bahru Malaysia - Stooges