我正在尝试在我的网站上添加微数据但我遇到了困难。
在wordpress的类别页面上,我正在尝试添加多个http://schema.org/BlogPosting
但我查看https://search.google.com/structured-data/testing-tool 我每次都有问题要添加发布者。 但总是一样,我想我每次都要重新定义? 那我怎样才能添加参考?
或者我是否通过尝试添加多个itemscope来遵循错误的方法?
<body>
<div itemscope itemtype="http://schema.org/Blogposting">
<header role="banner" id="headertop" itemscope itemtype="https://schema.org/Organization" itemprop="publisher" itemref="blockfanfb mypaqe_footer">
<div itemprop="logo" itemscope itemtype="https://schema.org/ImageObject">
<a id="header_logo" href="http://www.mywebsite/" title="mywebsite"><img itemprop="url" src="http://www.mywebsite/img/logo-4.jpg" alt="mywebsite" width="130" height="68"/></a>
<meta itemprop="width" content="130">
<meta itemprop="height" content="68">
<a href="http://www.mywebsite/" title="mywebsite" itemprop="name" > MYWEBSITE</a>
</div>
<nav itemscope itemtype="http://schema.org/BreadcrumbList">
<span itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a itemscope itemtype="http://schema.org/Thing" itemprop="item" href="http://www.mywebsite/">
<span itemprop="name">My site</span></a>
<meta itemprop="position" content="1" />
</span> ›
[…]
</nav>
</header>
<main role="main">
<article id="container" itemprop="articleBody">
<meta itemscope itemprop="mainEntityOfPage" itemType="https://schema.org/WebPage" itemid="http://mywebsite.com/blog/cat/"/>
<header class="iframe-responsive-wrapper">
<h1 itemprop="headline" class="page-title">Nvel catégorie</h1>
<p itemprop="author" itemscope itemtype="https://schema.org/Person">By <span itemprop="name">Me</span></p>
<time itemprop="datePublished" datetime="2016-11-24T13:01:32+00:00">2016-11-24T13:01:32+00:00</time>
<time class="updated" itemprop="dateModified" datetime="2016-11-24T13:56:51+00:00">2016-11-24T13:56:51+00:00</time>
</header>
<div>
<div class="category-description">
<p>test</p>
<div itemprop="image" itemscope itemtype="https://schema.org/ImageObject">
<img src="http://mywebsite.com/image.jpg" />
<meta itemprop="url" content="http://mywebsite.com/image.jpg">
<meta itemprop="width" content="1024">
<meta itemprop="height" content="1365">
</div>
</div>
</div>
<footer>
<hr>
Other article
<hr>
<section>
<!-- ARTICLE 1 -->
<div itemscope itemtype="http://schema.org/BlogPosting">
<meta itemscope itemprop="mainEntityOfPage" itemType="https://schema.org/WebPage" itemid="http://mywebsite.com/cat/article1/"/>
<meta itemprop="publisher" itemref="headertop blockfanfb mypaqe_footer">
<h3 class="entry-title" itemprop="headline"><a href="http://mywebsite.com/blog/new/image-en-direct-extrait-et-headline/" title="ARTICLE" itempropp="url" rel="bookmark">ARTICLE</a></h3>
<div>
<time itemprop="datePublished" datetime="2016-11-24T13:01:32+00:00">2016-11-24T13:01:32+00:00</time>
<time class="updated" itemprop="dateModified" datetime="2016-11-24T13:56:51+00:00">2016-11-24T13:56:51+00:00</time>
</div>
<span itemprop="author" itemscope itemtype="https://schema.org/Person">By <a href="https://plus.google.com/+Me?rel=author" rel="nofollow"><span itemprop="name">ME</span></a></span>
<div class="image-article-list" itemprop="image" itemscope itemtype="https://schema.org/ImageObject">
<img width="150" height="150" src="http://mywebsite.com/image.jpg" class="attachment-thumbnail" /
<meta itemprop="url" content="http://mywebsite.com/image.jpg">
<meta itemprop="width" content="150">
<meta itemprop="height" content="150">
</div>
<div class="resume-article-list">"Lorem ipsum dolor sit amet, [~]</div> </div>
</div>
<!-- ARTICLE 2 -->
<div itemscope itemtype="http://schema.org/BlogPosting">
<meta itemscope itemprop="mainEntityOfPage" itemType="https://schema.org/WebPage" itemid="http://mywebsite.com/cat/article1/"/>
<meta itemprop="publisher" itemref="headertop blockfanfb mypaqe_footer">
<h3 class="entry-title" itemprop="headline"><a href="http://mywebsite.com/blog/new/image-en-direct-extrait-et-headline/" title="ARTICLE2" itempropp="url" rel="bookmark">ARTICLE2</a></h3>
<div>
<time itemprop="datePublished" datetime="2016-11-24T13:01:32+00:00">2016-11-24T13:01:32+00:00</time>
<time class="updated" itemprop="dateModified" datetime="2016-11-24T13:56:51+00:00">2016-11-24T13:56:51+00:00</time>
</div>
<span itemprop="author" itemscope itemtype="https://schema.org/Person">By <a href="https://plus.google.com/+Me?rel=author" rel="nofollow"><span itemprop="name">ME</span></a></span>
<div class="image-article-list" itemprop="image" itemscope itemtype="https://schema.org/ImageObject">
<img width="150" height="150" src="http://mywebsite.com/image.jpg" class="attachment-thumbnail" /
<meta itemprop="url" content="http://mywebsite.com/image.jpg">
<meta itemprop="width" content="150">
<meta itemprop="height" content="150">
</div>
<div class="resume-article-list">"Lorem ipsum dolor sit amet, [~]</div> </div>
</div>
</section>
</footer>
</article>
</main>
<footer role="contentinfo">
[…]
<div id="mypaqe_footer" itemscope itemtype="http://schema.org/Corporation">
À propos de <span itemprop="name">mywebsite</span>
<meta itemprop="url" content="http://www.mywebsite">
<p itemprop="description">blla bla <time itemprop="foundingDate" datetime="2013-01-01">2013</time> par l'<span itemprop="founders">me</span></p><br />
Contact<br />
<p id="contact">
<span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">2405 street</span><br />
<span itemprop="postalCode">9999</span>
<span itemprop="addressLocality">bépo</span>,<br />
<meta itemprop="addressCountry" content="FR" />France
</span><br />
<span id="contact" itemprop="contactPoint" itemscope itemtype="http://schema.org/ContactPoint">
<a href="mailto:contact@mywebsite" itemprop="email">contact@mywebsite</a><br />
<meta itemprop="contactType" content="customer support">
Tel:<span itemprop="telephone">+33-9-12341234</span>,<span id="drapeau" class="sprite"></span>
</span>
</p>
</div>
<div>
<div id="blockfanfb">
<div id="fb-root"></div>
<a href="https://www.facebook.com/pages/me/123412342596423"> </a>
</div>
<div>
<a class="sprite" href="http://twitter.com/#!/mywebsite/"></a>
<a class="sprite" href="http://pinterest.com/mywebsite/"></a>
</div>
</div>
</footer>
</body>
</html>
答案 0 :(得分:1)
itemref
您使用itemref
的方式不正确。
您必须在要引用的元素上指定itemprop
,而不是在引用的元素上指定。{/ p>
所以结构看起来像这样:
<article itemscope itemtype="http://schema.org/BlogPosting" itemref="corp">
</article>
<article itemscope itemtype="http://schema.org/BlogPosting" itemref="corp">
</article>
<div id="corp" itemprop="publisher" itemscope itemtype="http://schema.org/Corporation">
</div>
(我假设项目Corporation
和Organization
与您的案例中的实体相同。如果这是真的,那么您不应该同时拥有它们。)
对博客中的某个类别使用BlogPosting
类型是不正确的。
我认为在您的情况下使用CollectionPage
是有意义的,这也允许您通过breadcrumb
属性添加BreadcrumbList
。
<div itemscope itemtype="http://schema.org/CollectionPage">
<nav itemprop="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList">
</nav>
</div>