2014-02-14 32 views
0

我剛開始在博客標記中使用微數據來實現SEO目的。但是,我不確定我是否正確使用或以最佳方式使用它。HTML博客標記中的最佳微數據

我有一個包含博客文章和博客存檔的頁面(其他博客鏈接列表)。這裏

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

任何幫助與正確的微數據標記和最佳做法將是非常有用的:標記目前看起來是這樣的。

回答

1

爲什麼你添加一個meta元素爲datePublished屬性,當你表現出在span反正日期?因此,而不是

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

你可以使用:

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

爲什麼不在這裏使用time element

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

article元素應該被用於整個博客文章,不只是文本正文。因此,與article,反之亦然替換div

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

這可以讓你使用一個header/footer的「元數據」(如出版日期和作者)。


Schema.org沒有定義一個名爲date屬性。您應該改爲使用datePublished


你可以(不是必須)添加主的博客文章作爲Blog項目的孩子,太:

(我會使用一個切片元素的「存檔帖」,)

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