[英]What microdata should I use for a blog?
The blog is basically a page that lists the summary of like 10 articles, each item title linking to the full article page.博客基本上是一个页面,列出了 10 篇文章的摘要,每个项目标题都链接到完整的文章页面。
I've seen:我见过:
Where do I use these?我在哪里使用这些?
Right now on the individual article page I have:现在在个人文章页面上,我有:
<article itemscope itemtype="http://schema.org/Article">
<h1 itemprop="name"> <a href="..."> A title... </a> </h1>
<div itemprop="articleBody">
bla bla
</div>
...
</article>
Which is ok I guess, but what do I do on the article index page?我猜这没问题,但我在文章索引页面上做什么? Do I add these to each article and add
itemscope itemtype="http://schema.org/Blog" itemprop="blogPosts"
to the container element of all articles?我是否将这些添加到每篇文章并将
itemscope itemtype="http://schema.org/Blog" itemprop="blogPosts"
到所有文章的容器元素? Because in the docs it doesn't appear that article is a child of blog...因为在文档中,文章似乎不是博客的子项...
I agree with what others say that the subject is very vague.我同意其他人所说的主题非常模糊。 Never the less I will attempt to express my thoughts on the matter and show you how I'm doing it on my blog.
无论如何,我将尝试表达我对此事的看法,并在我的博客上向您展示我是如何做的。
I use both WebPage and Blog item types in the same document to mark up different things.我在同一文档中同时使用WebPage和Blog项目类型来标记不同的内容。
I use WebPage item type on the body tag (but you can also use any other parent of the breadcrumb).我在 body 标签上使用WebPage项目类型(但您也可以使用面包屑的任何其他父级)。 By doing so I can mark up my bread crumbs.
通过这样做,我可以标记我的面包屑。
<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>
When I loop the blog posts I use the Blog item type on the wrapper that contains all of the blog articles.当我循环博客文章时,我在包含所有博客文章的包装器上使用博客项目类型。 I mark every article with the property
blogPosts
and uses of course BlogPosting as item type.我使用属性
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>
See edit below for an update to this opinion有关此意见的更新,请参阅下面的编辑
On the articles landing page I don't use the Blog item type.在文章登录页面上,我
不使用博客项目类型。 But I do mark the post as a BlogPosting item.但我确实将帖子标记为BlogPosting项目。
<article itemscope itemtype="http://schema.org/BlogPosting">
...
</article>
The only reason I can see that you would wanna mark something with a Blog item type is because of the blogPosts
properties and the fact to say that it is a blog.我可以看到您想用博客项目类型标记某些内容的唯一原因是因为 blogPosts
属性和说它是博客的事实。I think you fulfill saying that it's a blog by marking the article as a BlogPosting .我认为您可以通过将文章标记为BlogPosting 来说明它是博客。 I also don't think it's correct using the property in this context since this is used in a plural form.我也不认为在这种情况下使用该属性是正确的,因为它以复数形式使用。 To me that reflect a different area of use.对我来说,这反映了不同的使用领域。
I'm not sure if the schema has extended or if I missed it the first time around, but the Blog item has a property called blogPost
now, that is the singular form blogPosts
.我不确定模式是否已经扩展,或者我是否第一次错过了它,但是Blog项目现在有一个名为
blogPost
的属性,它是单数形式blogPosts
。 So then I would say that it makes more sense to mark up the main element as the Blog item and use the blogPost
property for the article and mark it up as a BlogPosting item那么我会说将主要元素标记为博客项并使用文章的
blogPost
属性并将其标记为BlogPosting项更有意义
I would use http://schema.org/WebPage for your all up page since this allows you to define things like Breadcrumbs/navigation which are important for describing a site regardless of the particular content.我会使用http://schema.org/WebPage作为你的全部页面,因为这允许你定义像面包屑/导航这样的东西,这对于描述一个站点很重要,而不管特定的内容。
There is still a lot of work needed in the microdata schemas and you've pointed out what appears to be a gap -- there is no parent/child relationship between Article and anything else that I can see (eg 'Articleindex' or 'Articles').微数据架构中仍然需要做很多工作,您已经指出了似乎存在差距的地方——文章与我能看到的任何其他内容(例如“文章索引”或“文章”)之间没有父/子关系')。
I haven't really read anything that indicates this parent child hierarchy is super important anyways, unless the parent is experssing attributes which are important to convey, so I think you can get away with either.我还没有真正读过任何表明这个父子层次结构非常重要的东西,除非父级正在表达重要的属性,所以我认为你可以逃脱。
However, you haven't mentioned what type of content the "articles" are.但是,您没有提到“文章”是什么类型的内容。 If they are more journalistic or official in nature (like a news article, research paper, etc) I'd use http://schema.org/Article for each article and not worry about the article index page.
如果它们本质上更具新闻性或官方性(如新闻文章、研究论文等),我会为每篇文章使用http://schema.org/Article而不必担心文章索引页面。 Otherwise, use http://schema.org/Blog http://schema.org/BlogPosting for each.
否则,为每个使用http://schema.org/Blog http://schema.org/BlogPosting。
The Article and Blog schema descriptions are pretty vague right now and will probably change sometime in the future, but i believe the Blog schema to be a little more relevant for a, well, blog (it's even implied in the Article schema description page down below, under " More specific types
").文章和博客模式描述现在非常模糊,将来可能会发生变化,但我相信博客模式与博客更相关(它甚至隐含在下面的文章模式描述页面中) ,在“
More specific types
”下)。
So, you can start by defining your main blog page with the higher level schema:因此,您可以首先使用更高级别的架构定义主博客页面:
<!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">
And you can define your blog pages with the second level blog schema, BlogPosting , and define the appropriate item properties, like so:您可以使用二级博客架构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">
Urghh, complicated :P, there are a million properties you can employ, but just focus on the most important ones.呃,复杂:P,您可以使用一百万个属性,但只关注最重要的属性。
Oops!哎呀! this code is error!
这段代码是错误的!
<!DOCTYPE html itemscope itemtype="http://schema.org/Blog">
You should use this code:您应该使用此代码:
<!DOCTYPE html>
instead of:代替:
<!DOCTYPE html itemscope itemtype="http://schema.org/Blog">
When we declare the type of the blog, we can add it in body tag:当我们声明博客的类型时,我们可以将其添加到body标签中:
<body itemscope='' itemtype='http://schema.org/Blog'>
Inside of this section, we can use "Itemprop" as the property of the itemtype.在本节中,我们可以使用“Itemprop”作为 itemtype 的属性。
We're talking about the type of a site, not a basic language of a site.我们谈论的是网站的类型,而不是网站的基本语言。
Here are other important itemscopes to use下面是使用其他重要itemscopes
Example for Person
例如,对于
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.