Drewdavid
Drewdavid

Reputation: 3192

"Invalid value type for field "name"" in Rich Results Test

Here is markup:

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

And here is Rich Results Test output:

enter image description here

What's wrong with this markup to produce this error? What is the correct way to include the item's name?

Upvotes: 1

Views: 901

Answers (2)

Tony McCreath
Tony McCreath

Reputation: 3399

In the microdata specification it does indicate that the value of an itemprop on an 'a' element is the 'href' attribute:

https://www.w3.org/TR/microdata/#values

If the element is an a, area, or link element: If the element has an href attribute, let proposed value be the result of resolving that attribute's textContent. If proposed value is a valid absolute URL: The value is proposed value. otherwise The value is the empty string

This surprised me as my recollection was that a property designated as a text type would use the elements textContent while id or url types would use the href. My recollection seems to be wrong.

So you would need to move the itemprop to an element outside or inside the 'a' element to capture the inner text with its valid content.

Upvotes: 1

user2540001
user2540001

Reputation:

In your markup, the property name is scoped to the link within which you set the property. This is contrary to the documentation Schema for this property:

Values expected to be one of these types - Text

Possible Solution: Set this property in the H3 element which is the parent of the link. E.g.:

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

Upvotes: 2

Related Questions