我想在我的网页中包含提取的结构化数据.
我将此包含在描述中:
<meta itemprop="description" content="my description" />
Run Code Online (Sandbox Code Playgroud)
但是我意识到页面上已经存在正常的元描述:
<meta name="description" content="my description" />
Run Code Online (Sandbox Code Playgroud)
是否可以将两者合并或者将它们合并在一起可能就像:
<meta itemprop="description" name="description" content="" />
Run Code Online (Sandbox Code Playgroud) 假设我有一些带有大量文本的html文档.是否"好"(〜不坏:))包含微数据的元素并隐藏这些元素,以便用户实际上看不到它们?
假设我有这个:
<div style="display:none" itemscope...>some microdata describing div below</div>
<div> There is actual text that is described by microdata</div>
Run Code Online (Sandbox Code Playgroud)
关键是这样可以更容易地描述第二个div.您不必在整个文本中进行更改,只需添加一些元素并隐藏它们即可.我想创建简单的HTML编辑器,支持创建微数据,这种方式似乎更容易实现,个人更容易使用(首先创建实际内容,然后注释它).
我有以下问题.我已将微数据架构添加到我的页面,但我想要隐藏.有人有想法吗?
我使用的代码如下:
<div itemscope itemtype="http://schema.org/LocalBusiness">
<a itemprop="url" href="http://www.example.net/"><div itemprop="name"><strong>Audiosky Mobile Development</strong></div>
</a>
<div itemprop="description">Description/div>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="addressLocality">Los Angeles</span><br>
<span itemprop="addressRegion">California</span><br>
<span itemprop="postalCode"></span><br>
<span itemprop="addressCountry">USA</span><br>
</div>
</div>
Run Code Online (Sandbox Code Playgroud) 一个组织的网站,比如"Sun Industries",想要添加一份员工名单.组织的地址和联系信息已存在于网页上,但员工列表将位于其他位置.
所以我们有
<div id="organization" itemscope itemtype="http://schema.org/Organization">
<span itemprop="name">Sun Industries</span>,
<span itemprop="location" itemscope itemtype="http://schema.org/Place">
<span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">Technologies Street 42</span>,
<span itemprop="addressLocality">Venustown</span>
<span itemprop="postalCode">98765</span>
</span>
</span>
</div>
Run Code Online (Sandbox Code Playgroud)
以后我们将在HTML5代码中
<div id="employee-1" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">John Doe</span>,
<span itemprop="jobTitle">Sales Manager</span>
</div>
Run Code Online (Sandbox Code Playgroud)
我尝试将以下子项添加到"employee-1"对象中
<meta itemprop="worksFor" itemscope itemtype="http://schema.org/Organization" itemref="organization">
Run Code Online (Sandbox Code Playgroud)
但这不起作用(至少在谷歌的结构化数据测试工具中没有).
itemref在这种情况下,如何正确使用微数据属性?为了清楚起见,我还尝试了以下方法:
itemprop="worksFor"到"组织"对象.itemref="organization"到"员工"对象.所以
<div id="organization" itemprop="worksFor" itemscope itemtype="http://schema.org/Organization">
<span itemprop="name">Sun Industries</span>,
...
</div>
...
<div id="employee-1" itemscope itemtype="http://schema.org/Person" itemref="organization">
<span itemprop="name">John Doe</span>,
<span itemprop="jobTitle">Sales …Run Code Online (Sandbox Code Playgroud) XHTML中的RDFa是w3c标准.微数据被称为HTML 5 API.我的问题是:
微数据也是w3c标准吗?如果是,为什么我们需要2个类似的标准?
人们说使用微数据比RDFa简单.除此之外,这两者之间的主要区别是什么?
提前谢谢Manoj
我正在开发的网站使用Microdata(使用schema.org).当我们将开发转移到使用React来渲染我们的视图时,我遇到了一个阻止程序,其中React只会在HTML规范中呈现属性,但Microdata指定了自定义属性,例如itemscope.
由于我是比较新的反应,还没有机会充分了解的核心,只是还没有,我的问题是什么将是扩展react.js的功能,允许自定义特性,例如,微观数据的最佳方式?
有没有一种扩展属性/道具解析器的方法,或者它是一个mixin的工作,它检查所有传递的道具并直接修改DOM元素?
(希望我们能够为每个人提供一个扩展,以便在解决方案明确时为此提供支持.)
我有一个问题:Google的结构化数据测试工具给了我一个错误:
标签
position不存在.这是必需的.
我将它添加到标记中.比我得到这个错误:
Positionproperty对于类型的对象无效Product
这是我的标记:
<table id="sale_table" itemscope="" itemtype="http://schema.org/ItemList">
<tbody>
<tr itemprop="itemListElement" itemscope="" itemtype="http://schema.org/Product">
<td class="sale_art_td" itemprop="productID">10496278</td>
<td class="sale_brand_td" itemprop="brand"><span itemprop="name ">--</span></td>
<td class="sale_name_td" itemprop="name">10496278 / ?????? ????????? Daewoo Nexia,Espero DD</td>
<td class="sale_am_td">1.00</td>
<td class="sale_price_td" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer"><meta itemprop="priceCurrency" content="RUR"><span itemprop="price">341.50</span></td>
<td class="sale_buy_td"><a href="javascript:void(0);" class="sale_buy_link" data-id="63455914" data-query="10496278">??????</a><!--<img src="/upload/badge/sale_cart.png" />--></td>
<td class="hidden">
<meta itemprop="url" content="/partsearch/?q=10496278">
<span itemprop="description">??????????: 10496278 / ?????? ????????? Daewoo Nexia,Espero DD ?? ???? 341.50</span>
</td>
</tr>
<tr itemprop="itemListElement" itemscope="" itemtype="http://schema.org/Product">
<td class="sale_art_td" itemprop="productID">76202sx0a12</td>
<td …Run Code Online (Sandbox Code Playgroud) 请看这里:https://developers.google.com/structured-data/testing-tool?url = https%253A%252F%252Fglamourina.net%252Fen%252F
如何正确添加mainEntityOfPage到此站点?
在Google文档示例中,我看到如下内容:
<div itemscope itemtype="http://schema.org/NewsArticle">
<meta itemscope itemprop="mainEntityOfPage" itemType="https://schema.org/WebPage" itemid="https://google.com/article"/>
Run Code Online (Sandbox Code Playgroud)
但这是一篇单独的作者博客.它的特色是blogPosts.
<article itemscope itemtype="https://schema.org/BlogPosting" class="singlearticles">
Run Code Online (Sandbox Code Playgroud)
如果我这样改变它会是好的:
<article itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
<meta itemscope itemprop="mainEntityOfPage" itemType="https://schema.org/WebPage" itemid="https://linktoarticle"/>
Run Code Online (Sandbox Code Playgroud)
不确定我是否理解其mainEntityOfPage用法.如果有人可以建议我如何处理这个特定的案例/网站,我将不胜感激.不一般,因为每个站点可以有不同的mainEntityOfPage,但我需要知道并理解该站点的正确实现.
TL; DR: Microdata强制您在与此itemprops vaule的itemtype相同的元素上使用itemprop.如果你想将你的模板分解为部分,你如何处理这个问题?元素可能只出现在两个位置中的一个位置,无论是在包含模板还是包含的部分中,两者都不能很好地工作.
我正在使用带有haml的Rails,但我想我的问题适用于任何模板引擎,您可以将模板拆分为较小的部分.我大量使用partials,这意味着我的模板通常不超过10行代码.但是将微观数据拟合到这些中似乎过于复杂,那么你应该如何正确地使用微数据?
举个例子:
#app/views/article/show.html.haml
%p Hey, Welcome! Read This wonderful article:
= render @article
#app/views/articles/_article.html.haml
%div[ article ]
%h1= @article.title
%p= @article.description
%div= render @article.video
#app/views/videos/_video.html.haml
%div[ video ]
%h2= video.file_name
%video{ src: video.url }
Run Code Online (Sandbox Code Playgroud)
现在使用微数据:
#app/views/articles/_article.html.haml
%div[ article ]{ itemscope: true, itemtype: 'http://schema.org/Article' }
%h1{ itemprop: 'name' }= @article.title
%p{ itemprop: 'description' }= @article.description
%div{ itemprop: 'video' }= render @article.video
Run Code Online (Sandbox Code Playgroud)
然后什么?我必须VideoObject在同一个div上添加itemtype,itemprop: 'video'因为这就是微数据的工作方式.所以:
#app/views/articles/_article.html.haml
%div{ itemprop: 'video', itemscope: true, itemtype: 'http://schema.org/VideoObject' }= render …Run Code Online (Sandbox Code Playgroud) 如果我使用<div>tag itemprop="review"itemscope itemtype="http://mydomainname.com/Review"itemtype,那么我是否需要在我的网站上创建一个名为review的页面?
microdata ×10
html5 ×4
html ×3
schema.org ×2
haml ×1
javascript ×1
meta-tags ×1
rdfa ×1
react-jsx ×1
reactjs ×1
reference ×1
semantic-web ×1