youbbs
youbbs
3432 7 0

一个 Article 搜索结构化数据参考

结构化数据是给搜索引擎看的,可以增强网页在 Google 搜索结果中的呈现效果。下面是根据 Google 的结构化数据指南与 schema.org 文档作出的一个 Article 类型的结构参考。

<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset=utf-8>
<title>example code of Article with Microdata</title>
</head>
<body>
面包屑导航
<ol itemscope itemtype="https://schema.org/BreadcrumbList">
<li itemprop="itemListElement" itemscope
itemtype="https://schema.org/ListItem">
<!-- Method 1 (preferred) -->
<a itemprop="item" href="https://example.com/books">
<span itemprop="name">Books</span></a>
<meta itemprop="position" content="1" />
</li>
›
<li itemprop="itemListElement" itemscope
itemtype="https://schema.org/ListItem">
<!-- Method 2 -->
<a itemprop="item" href="https://example.com/cat/science">
<span itemprop="name">Science Fiction</span></a>
<meta itemprop="position" content="2" />
</li>
›
<li itemprop="itemListElement" itemscope
itemtype="https://schema.org/ListItem">
<a itemprop="item" href="https://example.com/n/12">
<span itemprop="name">Award Winners</span>
</a>
<meta itemprop="position" content="3" />
</li>
</ol>

<div itemscope itemtype="http://schema.org/Article">
<h1 itemprop="headline">标题</h1>
<meta itemprop="mainEntityOfPage" content="http://www.mycorp.com/t/1">
<meta itemprop="description" content="简短描述">
<div itemprop="author publisher" itemscope itemtype="https://schema.org/Organization">
<div itemprop="logo" itemscope itemtype="https://schema.org/ImageObject">
<img src="http://www.mycorp.com/logo.jpg"/>
<meta itemprop="url" content="http://www.mycorp.com/logo.jpg">
<meta itemprop="width" content="400">
<meta itemprop="height" content="60">
</div>
<meta itemprop="name" content="MyCorp">
</div>
<div itemprop="image" itemscope itemtype="https://schema.org/ImageObject">
<img src="http://www.mycorp.com/logo.jpg"/>
<meta itemprop="url" content="http://www.mycorp.com/logo.jpg">
<meta itemprop="width" content="400">
<meta itemprop="height" content="60">
</div>

by <span itemprop="author">Rameshwar Ghosh</span>
<span itemprop="datePublished">2020-02-25 21:50:36</span>

<div itemprop="articleBody text">
This article has received 7 likes in facebook and received 3 google plus.
</div>

<span itemprop="dateModified">2020-02-25 21:50:36</span>

// 可选
<meta itemprop="commentCount" content="5">

<div itemprop="comment" itemscope itemtype="https://schema.org/Comment">
<div itemprop="author publisher" itemscope itemtype="https://schema.org/Person ">
<meta itemprop="name" content="MyCorp">
<meta itemprop="url" content="/member/aaa">
</div>
<meta itemprop="dateCreated" content="2020-02-25 21:50:36">
<div itemprop="name">第几楼</div>
<div itemprop="url">#12</div>
<div itemprop="text">回复内容</div>
</div
</div>
</body>
</html>

Google 建议使用 JSON-LD 来展现。但在某些场合,使用 JSON-LD 不方便,只能把相关标签嵌入到 HTML 里面。

在线测试工具

参考

0

See Also

Nearby


Discussion (7)

youbbs
youbbs 2020-03-01 07:45

做了一个提交脚本,Bing 秒收

0
youbbs
youbbs 2020-03-01 07:52

Google 收录也很快

修改的面包屑也立刻见效

0
youbbs
youbbs 2020-03-01 08:14

百度半小时后收录

0
waiducom
waiducom 2020-03-01 23:46

所以这个功能打算是放在goyoubbs Pro版本?(手动滑稽)

0
youbbs
youbbs 2020-03-02 05:59

@waiducom #4 先在这里测试

0
冒烟的蘑菇
冒烟的蘑菇 2020-03-03 10:50

这功能不错... ... 有百度的吗~

0
youbbs
youbbs 2020-03-04 01:40

@冒烟的蘑菇 #6 百度熊掌号支持 JSON-LD

<script type="application/ld+json">
    {
    "@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
    "@id": "当前网页URL",
    "appid": "熊掌号ID",
    "title": "你的网站标题",
    "images": [
        "https://路径"
    ],
    "description": "描述内容",
    "pubDate": "2020-03-04T08:00:01",
    "upDate": "2020-03-04T08:00:01"
    }
</script>
0
Login Topics