Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/hadoop/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html &引用;字段“”的值类型无效;名称“&引用;在丰富的结果测试_Html_Schema.org_Microdata_Google Search Console_Structured Data - Fatal编程技术网

Html &引用;字段“”的值类型无效;名称“&引用;在丰富的结果测试

Html &引用;字段“”的值类型无效;名称“&引用;在丰富的结果测试,html,schema.org,microdata,google-search-console,structured-data,Html,Schema.org,Microdata,Google Search Console,Structured Data,以下是标记: <div itemscope="" itemtype="http://schema.org/Vehicle" class="appitem sale" id="vehicle-5759"> <div class="appborder"> <div class=&quo

以下是标记:

<div itemscope="" itemtype="http://schema.org/Vehicle" class="appitem sale" id="vehicle-5759">
                    <div class="appborder">
                        <div class="appborder2">
                            
                            <div class="item-header">
                                <div class="title-header-wrapper">
                                    <div class="item-title">
                                        <h3><a href="/inventory/new/2021-northwood-mfg-arctic-fox3/" itemprop="name">2021 Northwood Mfg Arctic Fox 29RK</a></h3>
                                    </div>
                                    <div class="item-save-btn desktop-only">
                                        <a class="save-btn save_listing" data-guid="DDF0DA55-CCA0-41E3-A50E-5BE4EA845CC3">Save <i class="fa fa-star" aria-hidden="true"></i></a>
                                    </div> 

                                    <div class="clearfix"></div>
                                </div> 

                                <div class="item-header-features-list">
                                    <ul>
                                        <li><span class="bold-label">Model:</span> <span class="info">Arctic Fox</span></li>
<li><span class="bold-label">Condition:</span> <span class="info">New</span></li>

                                    </ul>

                                    <div class="clearfix"></div>
                                </div> 
                            </div>


此标记有什么问题导致此错误?如何正确地包含项目名称?

在标记中,属性名称的范围是设置属性的链接。这与相反:

值应为这些类型之一-Text

可能的解决方案:在H3元素(链接的父元素)中设置此属性。例如:

<h3 itemprop="name"><a href="/inventory/new/2021-northwood-mfg-arctic-fox3/">2021 Northwood Mfg Arctic Fox 29RK</a></h3>

在微数据规范中,它确实表明“a”元素上的itemprop的值是“href”属性:

如果图元是a、区域或链接图元: 如果元素具有 href属性,将建议的值作为解决该问题的结果 属性的文本内容。如果建议的值是有效的绝对URL: 该值为建议值。否则,该值为空字符串

这让我很惊讶,因为我记得指定为文本类型的属性将使用元素textContent,而id或url类型将使用href。我的记忆似乎是错的


因此,您需要将itemprop移动到“a”元素外部或内部的元素,以捕获内部文本及其有效内容。

谢谢,我将尝试一下!