简体   繁体   中英

Best microdata in HTML blog markup

I've just started using microdata in blog markup for SEO purposes. However, I'm not sure whether I'm using it correctly or in the best way.

I have a page with a blog post and a blog archive (list of other blog links). The markup currently looks like this:

<!--BLOG POST-->
<div itemscope itemtype="http://schema.org/BlogPosting">
  <h1 itemprop="name">Blog Title</h1>
  <meta itemprop="datePublished" content="2014-01-14">
  <span class="blogDate">2014-01-14</span>
  <span itemprop="author">Rich Cooper</span>
  <article itemprop="articleBody">Content in here</article>
</div>

<!--BLOG ARCHIVE-->
<ul itemscope itemtype="http://schema.org/Blog">
  <li itemprop="blogPosts" itemscope itemtype="http://schema.org/BlogPosting">
    <a href="blog-link" itemprop="url">Blog 1 title</a> 
    <time itemprop="date" datetime="2014-02-01">2014-02-01</time>
  </li>
  <li itemprop="blogPosts" itemscope itemtype="http://schema.org/BlogPosting">
    <a href="blog-link" itemprop="url">Blog 2 title</a> 
    <time itemprop="date" datetime="2014-01-15">2014-01-15</time>
  </li>
</ul>

Any help here with the correct microdata markup and best practices would be really useful.

Why do you add a meta element for the datePublished property when you show the date in a span anyway? So instead of

<meta itemprop="datePublished" content="2014-01-14">
<span class="blogDate">2014-01-14</span>

you could use:

<span class="blogDate" itemprop="datePublished">2014-01-14</span>

And why not use the time element here?

<time class="blogDate" itemprop="datePublished">2014-01-14</time>

The article element should be used for the whole blog post, not just the text body. So replace div with article and vice-versa:

<article itemscope itemtype="http://schema.org/BlogPosting">
  <h1 itemprop="name">Blog Title</h1>
  <time class="blogDate" itemprop="datePublished">2014-01-14</time>
  <span itemprop="author">Rich Cooper</span>
  <div itemprop="articleBody">Content in here</div>
</article>

This allows you to use a header / footer for the "metadata" (like publication date and author).


Schema.org doesn't define a property named date . You should probably use datePublished instead.


You could (not must) add the main blog post as child of the Blog item, too:

(and I'd use a sectioning element for the "archive posts",)

<div itemscope itemtype="http://schema.org/Blog">

  <article itemprop="blogPosts" itemscope itemtype="http://schema.org/BlogPosting">
    <!-- … -->
  </article>

  <section>
    <h1>Post archive</h1> <!-- or omit this heading -->
      <ul>
        <li itemprop="blogPosts" itemscope itemtype="http://schema.org/BlogPosting"><!-- … --></li>
        <li itemprop="blogPosts" itemscope itemtype="http://schema.org/BlogPosting"><!-- … --></li>
      </ul>
  </section>

</div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM