[英]What microdata should I use for a blog?
博客基本上是一个页面,列出了 10 篇文章的摘要,每个项目标题都链接到完整的文章页面。
我见过:
我在哪里使用这些?
现在在个人文章页面上,我有:
<article itemscope itemtype="http://schema.org/Article">
<h1 itemprop="name"> <a href="..."> A title... </a> </h1>
<div itemprop="articleBody">
bla bla
</div>
...
</article>
我猜这没问题,但我在文章索引页面上做什么? 我是否将这些添加到每篇文章并将itemscope itemtype="http://schema.org/Blog" itemprop="blogPosts"
到所有文章的容器元素? 因为在文档中,文章似乎不是博客的子项...
我同意其他人所说的主题非常模糊。 无论如何,我将尝试表达我对此事的看法,并在我的博客上向您展示我是如何做的。
我在同一文档中同时使用WebPage和Blog项目类型来标记不同的内容。
我在 body 标签上使用WebPage项目类型(但您也可以使用面包屑的任何其他父级)。 通过这样做,我可以标记我的面包屑。
<body itemscope itemtype="http://schema.org/WebPage">
<ul itemprop="breadcrumb">
<li>
<a href="foo">foo</a>
</li>
<li>
<a href="foo/bar">bar</a>
</li>
<li>
<a href="foo/bar/baz">baz</a>
</li>
</ul>
...
</body>
当我循环博客文章时,我在包含所有博客文章的包装器上使用博客项目类型。 我使用属性blogPosts
标记每篇文章,并使用BlogPosting作为项目类型。
<section itemscope itemtype="http://schema.org/Blog">
<article itemprop="blogPosts" itemscope itemtype="http://schema.org/BlogPosting">
...
</article>
<article itemprop="blogPosts" itemscope itemtype="http://schema.org/BlogPosting">
...
</article>
...
</section>
有关此意见的更新,请参阅下面的编辑
在文章登录页面上,我不使用博客项目类型。 但我确实将帖子标记为BlogPosting项目。
<article itemscope itemtype="http://schema.org/BlogPosting">
...
</article>
我可以看到您想用博客项目类型标记某些内容的唯一原因是因为 blogPosts
属性和说它是博客的事实。我认为您可以通过将文章标记为BlogPosting 来说明它是博客。 我也不认为在这种情况下使用该属性是正确的,因为它以复数形式使用。 对我来说,这反映了不同的使用领域。
我不确定模式是否已经扩展,或者我是否第一次错过了它,但是Blog项目现在有一个名为blogPost
的属性,它是单数形式blogPosts
。 那么我会说将主要元素标记为博客项并使用文章的blogPost
属性并将其标记为BlogPosting项更有意义
我会使用http://schema.org/WebPage作为你的全部页面,因为这允许你定义像面包屑/导航这样的东西,这对于描述一个站点很重要,而不管特定的内容。
微数据架构中仍然需要做很多工作,您已经指出了似乎存在差距的地方——文章与我能看到的任何其他内容(例如“文章索引”或“文章”)之间没有父/子关系')。
我还没有真正读过任何表明这个父子层次结构非常重要的东西,除非父级正在表达重要的属性,所以我认为你可以逃脱。
但是,您没有提到“文章”是什么类型的内容。 如果它们本质上更具新闻性或官方性(如新闻文章、研究论文等),我会为每篇文章使用http://schema.org/Article而不必担心文章索引页面。 否则,为每个使用http://schema.org/Blog http://schema.org/BlogPosting。
文章和博客模式描述现在非常模糊,将来可能会发生变化,但我相信博客模式与博客更相关(它甚至隐含在下面的文章模式描述页面中) ,在“ More specific types
”下)。
因此,您可以首先使用更高级别的架构定义主博客页面:
<!DOCTYPE html itemscope itemtype="http://schema.org/Blog">
<meta itemprop="creator" content="Creator of the blog">
<meta itemprop="name" content="Title of your Blog">
<meta itemprop="description" content="Description of your blog">
<meta itemprop="image" content="http://www.yourblog.com/main/image/pic.gif">
您可以使用二级博客架构BlogPosting定义您的博客页面,并定义适当的项目属性,如下所示:
<!DOCTYPE html itemscope itemtype="http://schema.org/BlogPosting">
<meta itemprop="author" content="Author of your blog">
<meta itemprop="name" content="Title of your content">
<meta itemprop="description" content="Description of your post">
<meta itemprop="image" content="http://www.yourblog.com/post/image/pic.gif">
呃,复杂:P,您可以使用一百万个属性,但只关注最重要的属性。
哎呀! 这段代码是错误的!
<!DOCTYPE html itemscope itemtype="http://schema.org/Blog">
您应该使用此代码:
<!DOCTYPE html>
代替:
<!DOCTYPE html itemscope itemtype="http://schema.org/Blog">
当我们声明博客的类型时,我们可以将其添加到body标签中:
<body itemscope='' itemtype='http://schema.org/Blog'>
在本节中,我们可以使用“Itemprop”作为 itemtype 的属性。
我们谈论的是网站的类型,而不是网站的基本语言。
下面是使用其他重要itemscopes
例如,对于Person
<div itemscope itemtype="http://schema.org/Person">
<span itemprop="name">Mahdi Maghrooni</span>
<img src="http://maghrooni.ir/img/users/FCwNdpWQKGQqiZphN6rj2YuHY3bXrF.jpg" itemprop="image" alt="Maghrooni" />
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.