如何为微数据嵌套 <meta> 标签?

jan*_*nw1 6 html meta microdata schema.org

我有这样的结构:

+ EVENT -> itemtype="http://schema.org/Event
 + Name   
 + Date   
 + ...
 + LOCATION -> itemtype="http://schema.org/Place
        *          Name
     + Url
     + ...
Run Code Online (Sandbox Code Playgroud)

我不会在网站上显示所有地点信息,但我想将这些信息用于微数据。所以我想添加这个标签:

<meta itemprop="location" itemscope itemtype="http://schema.org/Place">
Run Code Online (Sandbox Code Playgroud)

工作正常。

但是我怎样才能添加 itemprops name, url, "address" 呢location

它不会像这样工作:

<meta itemprop="location" itemscope itemtype="http://schema.org/Place">
<meta itemprop="url" content="https://example-location.com">
<meta itemprop="name" content="exampleLocationName">
Run Code Online (Sandbox Code Playgroud)

Mar*_*chi 0

您必须将事件微数据包装在事件实体内。在您的具体情况下:

<div itemscope itemtype="http://schema.org/Event">
    <h1 itemprop="name">Name</h1>
    <time itemprop="startDate" datetime="2018-07-28T20:23:16+02:00" content="2018-07-28T20:23:16+02:00">28 luglio 2018</time>
    ...
    <div itemprop="location" itemscope itemtype="https://schema.org/Place">
        <h2>Location: <span itemprop="name">Location Name</span></h2>
        <meta itemprop="url" content="https://example-location.com">
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

如果你想隐藏所有的位置信息,你可以像上面一样操作,但隐藏整个事件实体:

<div itemscope itemtype="http://schema.org/Event">
    ...
    <div style='display: none;' itemprop="location" itemscope itemtype="https://schema.org/Place">
        <meta itemprop="name" content="Location Name">
        <meta itemprop="url" content="https://example-location.com">
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)