Probably like this. Actually unsure of it.
<meta itemprop="location" content="" itemscope itemtype="http://schema.org/Place" itemref="place-url place-name">
<link id="place-url" itemprop="url" href="https://example-location.com">
<meta id="place-name" itemprop="name" content="exampleLocationName">
Can’t you just ditch the ugly empty content
?
If a meta
element has an itemprop
attribute, the name
, http-equiv
, and charset
attributes must be omitted, and the content
attribute must be present.
You can’t.
Why <link>
instead of <meta>
?
Because only URL property elements can have an absolute URL as their values, and <link>
is one while <meta>
is not.
From https://www.w3.org/TR/microdata#x5-4-values-the-content-attribute-element-specific-attributes-and-element-content:
The algorithm to determine the value for a name-value pair is given by
applying the first matching case in the following list:
- If the element also has an
itemscope
attribute: the value is the item
created by the element.
- If the element has a
content
attribute: the value is the textContent
of
the element’s content
attribute.
The URL property elements are the a
, area
, audio
, embed
, iframe
, img
, link
, object
, source
, track
, and video
elements.
If a property’s value, as defined by the property’s definition, is an absolute URL, the property must be specified using a URL property element.
How about nesting <meta>
tags?
You cannot, as the <meta>
is a void element, which must not have any children.
Better yet
Have you considered using JSON-LD instead?