-->

Proper way to use the 'publisher' property

2020-04-12 02:12发布

问题:

When I attempt to validate my structured data using Google's Structured Data Testing tool, I get an error:

The attribute publisher.itemtype has an invalid value.

I am getting that on this line:

<meta itemprop="publisher" content="My Real Name Here" />

How do I provide a valid value for this property?

回答1:

The expected value of the publisher property is another item (Organization or Person).

While Schema.org always allows to provide a string value (like you do), Google might require a certain value type for one of their search features (e.g., an Organization value for their Articles rich result for AMP HTML pages). If you don’t care about (or can’t qualify for) this feature, you can ignore the error in the SDTT.

The problems with using a string value: it’s not clear if the publisher is a person or an organization, and it’s not possible to provide additional data about the publisher.

If you want to provide an item, it could look like:

<div itemprop="publisher" itemscope itemtype="http://schema.org/Person">
  <p itemprop="name">NewGuy</p>
</div>
<div itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
  <p itemprop="name">NewGuy Inc.</p>
</div>