我正在向專案添加元標記,并且我一直在閱讀 OpenGraph 檔案,但是每次看到 og:image 時,接下來總是一個 URL。是否可以傳入檔案?
file structure:
public
index.html
images
staticimage.png
Can I just...
<meta property="og:image" content="./images/staticimage.png" />
到目前為止它似乎沒有作業。
uj5u.com熱心網友回復:
相對 URL 不起作用,該og:image屬性只能處理完整 URL。
該og:image屬性確實有一些可選的結構化屬性:
og:image:url- 與 og:image 相同。og:image:secure_url- 網頁需要 HTTPS 時使用的備用網址。og:image:type- 此影像的 MIME 型別。og:image:width- 像素寬度。og:image:height- 高像素數。og:image:alt- 對影像內容的描述(不是標題)。如果頁面指定了一個 og:image 它應該指定og:image:alt.
一個完整的影像示例:
<meta property="og:image" content="https://example.com/ogp.jpg" />
<meta property="og:image:secure_url" content="https://secure.example.com/ogp.jpg" />
<meta property="og:image:type" content="image/jpeg" />
<meta property="og:image:width" content="400" />
<meta property="og:image:height" content="300" />
<meta property="og:image:alt" content="A shiny red apple with a bite taken out" />
來源: https : //ogp.me/#structured
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/361709.html
