博客应该用什么微数据?

问题描述 投票:36回答:5

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

html seo blogs microdata
5个回答
43
投票

我同意其他人所说的,这个主题非常模糊。尽管如此,我将尝试表达我对这个问题的想法,并在我的博客上向你展示我是如何做的。

我同时使用了 网页博客 项目类型在同一文档中标记不同的东西。

网页

我用的是 网页 项目类型(但你也可以使用面包屑的任何其他父类)。通过这样做,我可以把我的面包屑标记起来。

<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 和用途 博客发布 作为项目类型。

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

文章页面

见下文对该意见的更新。

在文章登陆页面,我 不要 使用 博客 项目类型。但我确实将该帖子标记为 博客发布 项目。

<article itemscope itemtype="http://schema.org/BlogPosting">
  ...
</article>

我看到的唯一理由是,你会想用 博客 项目类型是由于 blogPosts 属性和事实,说它是一个博客。我认为你履行说这是一个博客,标记的文章作为一个 博客发布.我也不认为在这种情况下使用属性是正确的,因为这是以复数形式使用的。对我来说,这反映了不同的使用领域。


编辑

我不知道是模式扩展了还是我第一次漏掉了,但是这个 博客 项目有一个叫做 blogPost 即为单数 blogPosts. 因此,我认为将主要元素标记为 "主元素 "更有意义。博客 项目,并使用 blogPost 的属性,并将其标记为一个 博客发布


7
投票

我会用 http:/schema.orgWebPage 因为这允许你定义像Breadcrumbsnavigation这样的东西,这些东西对于描述一个网站是很重要的,不管具体的内容是什么。

在微数据模式中还有很多工作要做,你已经指出了一个似乎是空白的地方--在Article和其他任何东西之间没有父子关系(例如'Articleindex'或'Articles')。

我还没有真正读到任何东西表明这个父子层次结构是超级重要的,无论如何,除非父体是expressssing属性,这是很重要的传达,所以我认为你可以摆脱任何一个。

但是,你还没有提到 "文章 "是什么类型的内容。如果它们更多的是新闻或官方性质的(比如一篇新闻文章,研究报告等),我会用 "文章"。http:/schema.orgArticle 而不用担心文章索引页的问题。否则,使用 http:/schema.orgBlog http:/schema.orgBlogPosting。


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">

然后你可以用二级博客模式定义你的博客页面。博客发布,并定义相应的项目属性,像这样。

<!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,你可以使用一百万个属性,但只需关注最重要的属性。


2
投票

哎呀!这个代码是错误的。

<!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的属性。我们说的是一个网站的类型,而不是一个网站的基本语言。


1
投票

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

例子 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>
© www.soinside.com 2019 - 2024. All rights reserved.