Original link: https://hsiaofeng.com/archives/209.html
Microdata is part of the WHATWG HTML standard for nesting metadata within existing content on web pages. Search engines, web crawlers, and browsers can extract and process microdata from web pages and use it to provide users with a richer browsing experience.
– MDN: Microdata
All in all, using canonical microdata allows automated programs such as search engines to better display and categorize things. Typically, we implement microdata using some of the keywords specified in the Schema.org vocabulary database.
one example
Here’s a code snippet from a blog post that uses microdata markup:
<article itemscope itemtype="http://schema.org/BlogPosting"> <header> <h2 itemprop="headline">微数据(Microdata) 摘要</h2> <p><time itemprop="datePublished" datetime="2022-11-8">2022 / 11 / 8</time></p> <link itemprop="url" href="?comments=0"> </header> <p>微数据是WHATWG HTML 标准的一部分,用于在网页上的现有内容中嵌套元数据。搜索引擎、网络抓取工具和浏览器可以从网页中提取和处理微数据,并使用它为用户提供更丰富的浏览体验。</p> <p>...</p> <footer> <a itemprop="discussionUrl" href="?comments=1">查看评论</a> </footer> </article>
Articles are contained within the <article>
tag, which has the attribute itemscope
, which is used to mark that the element will have some data items associated with the metadata. The type itemtype
for these elements is set to http://schema.org/BlogPosting
, which points to the Schema.org-defined vocabulary for blogging.
Some of the elements in the <article>
tag are set with the itemprop
attribute, indicating the special meaning of these elements under the itemtype
specification, for example, ” headline
” indicates the title of the article.
Using these tags, the content can be more easily processed by automated programs.
Related Reading
- Schema.org ( Chinese site )
- HTML Standard: 4.3.2 The
article
element - MDN: Microdata
- MDN: itemtype
- MDN: itemprop
This article is reproduced from: https://hsiaofeng.com/archives/209.html
This site is for inclusion only, and the copyright belongs to the original author.