如何使用meta获取链接卡

时间:2019-03-04 13:43:16

标签: html meta

我有一个包含几页的网站,例如,如果我想与某人共享我的链接之一并通过whatsapp发送,则需要在徽标中看到徽标和一些文本。 [如这张图片上所示]

enter image description here

我该怎么做?

我刚刚找到了这个样本:

<link rel="shortcut icon" href="img/img.svg">
<link rel="apple-touch-icon image_src" href="img/img.svg">
<meta name="twitter:title" property="og:title" itemprop="name" content="Link to source">
<meta name="twitter:description" property="og:description" itemprop="description" content="Mycontent">

2 个答案:

答案 0 :(得分:0)

您必须添加一些元标记。

<meta property="og:site_name" content="Your site name">
<meta property="og:title" content="Page title" />
<meta property="og:description" content="Page description" />
<meta property="og:image" itemprop="image" content="your_page_image.png">
<meta property="og:type" content="website" />

答案 1 :(得分:0)

您可以尝试使用以下代码:https://cards-dev.twitter.com/validator

<head>
    <meta property="og:type" content="website">
    <meta property="og:url" content="https://stackoverflow.com/questions/54984552/how-to-get-link-to-source-using-htm-css">
    <meta property="og:site_name" content="Stack Overflow">
    <meta property="og:image" itemprop="image primaryImageOfPage" content="https://cdn.sstatic.net/Sites/stackoverflow/img/apple-touch-icon@2.png?v=73d79a89bded">
    <meta name="twitter:card" content="summary">
    <meta name="twitter:domain" content="stackoverflow.com">
    <meta name="twitter:title" property="og:title" itemprop="name" content="How to get link to source using htm css">
    <meta name="twitter:description" property="og:description" itemprop="description" content="I have a web site with a few pages and for example if I want to share with somebody one of my link and send it via whatsapp, I need to see logo and some text in my message. [as it on this image] H...">

enter image description here