标签导航:
在微信公众号文章中显示链接预览的方法包括:配置文章详情页的 og:title、og:description、og:image、og:url 页面参数,以及添加 microdata 或 json-ld 结构化数据。添加的外链图片尺寸不宜过大,可在草稿箱中预览效果,不同微信版本显示效果可能有所差异。

微信公众号怎么发链接预览

如何让微信公众号文章显示链接预览

微信公众号文章中显示链接预览(卡片),可以吸引用户的注意力,提高点击率。以下是如何实现这一功能的方法:

一、配置文章详情页的页面参数

在文章详情页的 HTML 代码中,需要添加以下几个页面参数:

  • og:title:预览中显示的标题
  • og:description:预览中显示的描述
  • og:image:预览中显示的图片
  • og:url:预览中的链接地址

例如:

<meta property="og:title" content="文章标题" />
<meta property="og:description" content="文章描述" />
<meta property="og:image" content="https://example.com/image.jpg" />
<meta property="og:url" content="https://example.com/article" />

二、添加 Microdata 或 JSON-LD

在文章正文的 HTML 代码中,还可以添加 Microdata 或 JSON-LD 结构化数据,以进一步丰富预览信息。

Microdata:

<div itemscope itemtype="http://schema.org/Article">
  <h1 itemprop="name">文章标题</h1>
  <div itemprop="description">文章描述</div>
  <link itemprop="image" href="https://example.com/image.jpg" />
  <link itemprop="url" href="https://example.com/article" />
</div>

JSON-LD:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Article",
  "name": "文章标题",
  "description": "文章描述",
  "image": "https://example.com/image.jpg",
  "url": "https://example.com/article"
}
</script>

注意:

  • 所添加的图片 URL 必须为外链地址,且图片尺寸不宜过大。
  • 如果要在草稿箱中预览链接效果,需要将文章设置为 "发布" 状态。
  • 不同微信版本显示效果可能有所差异。