简体   繁体   English

我已将微数据添加到网页HTML中,但是在从CMS发布时会显示

[英]I've added Microdata to web page HTML, but it shows up on publishing from CMS

As explained in searchengineland.com, I've added the following navigation markup but it shows up on publishing the site above the header. 如searchengineland.com中所述,我添加了以下导航标记,但它在发布网站时显示在标题上方。 I want it to show up like the attached image in Google search results: 我希望它能像附件中的图像一样显示在Google搜索结果中:

搜索结果的站点导航菜单示例

I'm using Sandvox for Mac to publish the site. 我正在使用Mac的Sandvox来发布站点。 Where should I add the Microdata HTML? 我应该在哪里添加Microdata HTML?

I tried to put it inside this code and it just prints on the published page: 我试图将其放在此代码内,并且仅打印在已发布的页面上:

<div  itemscope itemtype="http://schema.org/LocalBusiness" id="sitemenu">
.....
<div itemscope itemtype="http://schema.org/SiteNavigationElement">
<ul itemscope itemtype="http://www.schema.org/SiteNavigationElement">
<li itemprop="name"><a itemprop="url" href="http://www.travelstore.com/our-   advantage">Our Advantage</a></li>
<li itemprop="name"><a itemprop="url" href="http://www.travelstore.com/our- travel-experts">Travel Experts</a></li>
<li itemprop="name"><a itemprop="url" href="http://www.travelstore.com/destinations">Destinations</a></li>
<li itemprop="name"><a itemprop="url" href="http://www.travelstore.com/cruises">Cruises</a></li>
<li itemprop="name"><a itemprop="url" href="http://www.travelstore.com/interests">Interests</a></li>
<li itemprop="name"><a itemprop="url" href="http://www.travelstore.com/explore-your-world/interests/hotels-and-resorts">Hotels</a></li>
<li itemprop="name"><a itemprop="url" href="http://www.travelstore.com/travel-guides">Travel Resources</a></li>
</ul>
</div>

Your screenshot of the Google Search result shows two features: 您的Google搜索结果屏幕截图显示了两个功能:

  • a search field that searches the result site 搜索结果站点的搜索字段
  • links to other pages of the site 链接到网站其他页面

You can provide structured data markup to get the first feature ( Sitelinks Searchbox ), you can't provide structured data markup to get the second feature ( sitelinks ). 可以提供结构化数据标记来获取第一个功能( 站点 链接搜索框 ), 而不能提供结构化数据标记来获取第二个功能( 站点链接 )。

Schema.org's SiteNavigationElement type doesn't seem to get used by Google Search for any of their result features. Google Search似乎没有使用Schema.org的SiteNavigationElement类型的任何结果功能。 I recommend not to use SiteNavigationElement at all. 建议完全不要使用SiteNavigationElement

If you want to use SiteNavigationElement anyway, note that you are not using it correctly: you can only markup the whole navigation , not single navigation links. 如果仍然要使用SiteNavigationElement ,请注意您使用的方式不正确: 您只能标记整个导航 ,而不能标记单个导航链接。 So the url and name properties of SiteNavigationElement are for the URL and the name of the navigation itself (and a navigation typically doesn't have these). 因此, SiteNavigationElementurlname属性用于URL和导航本身的名称(并且导航通常不包含这些属性)。 So it would be: 因此它将是:

<ul itemscope itemtype="http://schema.org/SiteNavigationElement">
  <li><a href="http://www.travelstore.com/our-advantage">Our Advantage</a></li>
  <li><a href="http://www.travelstore.com/our-travel-experts">Travel Experts</a></li>
  <li><a href="http://www.travelstore.com/destinations">Destinations</a></li>
</ul>

(Note that Schema.org URIs should be specified without the www subdomain.) (请注意,Schema.org URI应该在没有www子域的情况下指定。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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