40

博客基本上是一个页面,列出了大约 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"到所有文章的容器元素中?因为在文档中,该文章似乎不是博客的子项...

4

5 回答 5

47

我同意其他人所说的主题非常模糊的说法。尽管如此,我还是会尝试表达我对此事的看法,并在我的博客上向您展示我是如何做到的。

我在同一个文档中同时使用WebPageBlog项目类型来标记不同的内容。

网页

我在 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来满足说这是一个博客。我也不认为在这种情况下使用该属性是正确的,因为它以复数形式使用。对我来说,这反映了不同的使用领域。


编辑

我不确定架构是否已经扩展,或者我是否第一次错过了它,但博客项目有一个名为blogPostnow 的属性,即单数形式blogPosts。那么我会说将主要元素标记为博客项目并使用blogPost文章的属性并将其标记为BlogPosting项目更有意义

于 2012-04-03T23:50:33.410 回答
7

我会为您的全部页面使用http://schema.org/WebPage,因为这允许您定义诸如面包屑/导航之类的内容,这些内容对于描述网站很重要,而不管特定内容如何。

在微数据模式中仍然需要做很多工作,您已经指出了似乎存在的差距——文章与我可以看到的任何其他内容(例如“文章索引”或“文章”之间没有父/子关系')。

无论如何,我还没有真正读过任何表明这个父子层次结构非常重要的东西,除非父级正在表达对传达很重要的属性,所以我认为你可以侥幸逃脱。

但是,您没有提到“文章”是什么类型的内容。如果它们本质上更具新闻性或官方性(例如新闻文章、研究论文等),我会为每篇文章使用http://schema.org/Article,而不必担心文章索引页面。否则,对每个使用http://schema.org/Blog http://schema.org/BlogPosting。

于 2012-01-14T23:33:14.920 回答
6

文章和博客模式描述现在非常模糊,并且可能会在未来的某个时候改变,但我相信博客模式与博客更相关(它甚至在下面的文章模式描述页面中暗示, 在 " 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,你可以使用一百万个属性,但只关注最重要的属性。

于 2012-01-15T02:02:23.857 回答
3

哎呀!这段代码是错误的!

<!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'>

Inside of this section, we can use "Itemprop" as the property of the itemtype.
We're talking about the type of a site, not a basic language of a site.

于 2014-02-26T17:22:48.817 回答
2

以下是其他要使用的重要项目范围

示例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>
于 2014-02-18T08:51:21.797 回答