我该怎么窝 Microdata的标签?

问题描述 投票:3回答:1

我有这种结构:

+ EVENT -> itemtype="http://schema.org/Event
 + Name   
 + Date   
 + ...
 + LOCATION -> itemtype="http://schema.org/Place
        *          Name
     + Url
     + ...

我不会在网站上显示所有地方信息,但我想使用Microdata的信息。所以我想添加这个标签:

<meta itemprop="location" itemscope itemtype="http://schema.org/Place">

工作良好。

但是,如何为name添加urllocation,“地址”的itemprops?

它不会像:

<meta itemprop="location" itemscope itemtype="http://schema.org/Place">
<meta itemprop="url" content="https://example-location.com">
<meta itemprop="name" content="exampleLocationName">
html5 meta schema.org microdata
1个回答
0
投票

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

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

如果要隐藏所有位置信息,可以按上述操作,但隐藏整个Event实体:

<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>
© www.soinside.com 2019 - 2024. All rights reserved.