我正在使用 reactjs ,我想在 facebook 上分享我的内容,它正在发生,但在分享后它没有显示图像、标题、内容描述。所以我使用react-helmet在 index.html 中动态添加元标记。
<Helmet>
<meta property="og:type" content="video.other" />
<meta property="og:image" content="https://www.w3schools.com/css/trolltunga.jpg" />
<meta property="og:title" content="My Title" />
<meta property="og:url" content="https://www.afnity.com/video/155" />
<meta property="og:description" content="some discription of the shared content" />
</Helmet>
Run Code Online (Sandbox Code Playgroud)
这是分享按钮
<button> <a title="dummy"
href="http://www.facebook.com/sharer.php? u=https://dummy.com/videos/id=25" target="_blank">
share</a>
</button>
Run Code Online (Sandbox Code Playgroud)
但它不起作用。
Irf*_*Ali -3
将头盔组件替换为以下代码。
<Helmet
meta={[
{"property": "og:type", "content": "video.other"}
{"property": "og:image", "content": "https://www.w3schools.com/css/trolltunga.jpg"}
{"property": "og:title", "content": "My Title"}
{"property": "og:url", "content": "https://www.afnity.com/video/155"}
{"property": "og:description", "content": "some discription of the shared content"}
]}
/>
Run Code Online (Sandbox Code Playgroud)
这将根据您的要求添加元标记。
| 归档时间: |
|
| 查看次数: |
13767 次 |
| 最近记录: |