简体   繁体   English

这是建筑物的适当Schema.org/Microdata标记吗?

[英]Is this proper Schema.org/Microdata markup for a building?

I am trying to add Microdata notation (using Schema.org) to my website which basically talks about buildings. 我正在尝试将Microdata表示法(使用Schema.org)添加到我的网站,该网站主要讨论建筑物。 I've been reading a lot about it but I'm still having trouble figuring out where to use itemscope , itemtype and itemprop . 我已经阅读了很多有关它的内容,但是仍然很难弄清在哪里使用itemscopeitemtypeitemprop

Can anybody tell me if this is good Microdata/Schema.org markup or if I'm missing something? 谁能告诉我这是不是很好的Microdata / Schema.org标记,或者我缺少什么?

<div class="infobox infobox_building" itemscope itemtype="http://schema.org/LandmarksOrHistoricalBuildings">

    <!-- Building Name -->
    <h1 class="page_title">Puente Golden Horn Metro</h1>

    <!-- Architect -->
    <div class="data_row architect" itemscope itemtype="http://schema.org/creator">
        <div class="tag cell">Arquitecto</div>
        <div class="value cell">
            <a href="https://stage.wikiarquitectura.com/arquitecto/virlogeux-michel/" itemprop="Person">Michel Virlogeux</a>
            <a href="https://stage.wikiarquitectura.com/arquitecto/kiran-hakan/" itemprop="Person">Hakan Kıran</a>                                                  
        </div>
    </div>

    <!-- Height -->
    <div class="data_row" itemscope itemtype="http://schema.org/height">
        <div class="tag cell">Altura</div>
        <div class="value cell" itemprop="QuantitativeValue">65m</div>
    </div>

    <!-- Width -->
    <div class="data_row" itemscope itemtype="http://schema.org/width">
        <div class="tag cell">Ancho</div>
        <div class="value cell" itemprop="QuantitativeValue">12,6m</div>
    </div>

    <!-- Location -->
    <div class="data_row" itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
        <div class="tag cell">Ubicación</div>
        <div class="value cell" itemprop="streetAddress">Arap Cami Mahallesi, Beyoğlu/İstanbul, Turquía</div>
    </div>

</div> <!-- infobox -->

You seem to confuse properties and types. 您似乎混淆了属性和类型。

In Microdata, properties get specified in the itemprop attribute, while types get specified in the itemtype attribute. 在微数据中,属性在itemprop属性中指定,而类型在itemtype属性中指定。

If you only use the vocabulary Schema.org, you'll use the full URI for types ( itemtype="http://schema.org/PostalAddress" ), while you use just the slug for properties ( itemprop="address" ). 如果仅使用词汇表Schema.org,则将对类型( itemtype="http://schema.org/PostalAddress" )使用完整的URI,而仅对属性使用(slug)属性( itemprop="address" ) 。

In Schema.org, it's easy to see what is what, because they follow the convention that the first letter of properties is lowercase ( address ), and the first letter of types is uppercase ( PostalAddress ). 在Schema.org中,很容易看出是什么,因为它们遵循以下约定 :属性的第一个字母为小写( address ),类型的第一个字母为大写( PostalAddress )。


Syntactically, you are doing it correctly with address + PostalAddress , but wrong with creator + Person and height / width + QuantitativeValue . 从句法上讲,您使用address + PostalAddress正确执行了操作,但是对于creator + Personheight / width + QuantitativeValue却做错了。

That said, you are also making some vocabulary errors. 也就是说,您还犯了一些词汇错误。 The LandmarksOrHistoricalBuildings type can't have a creator nor a height nor a width property in the first place. LandmarksOrHistoricalBuildings类型不能同时具有creatorheightwidth属性。

You can see which properties a type can have by visiting the type's page ( LandmarksOrHistoricalBuildings ) and checking the first table. 您可以通过访问类型的页面( LandmarksOrHistoricalBuildings )并检查第一个表来查看类型可以拥有的属性。

I also had the same problem or question like you. 我也有和您一样的问题。 Because my buildings are not even historical (when is a building historical?), I created my own schema : 因为我的建筑物甚至都不是历史建筑物(建筑物何时是历史建筑物?),所以我创建了自己的架构

{
   "@context":
   {
      "Place": "http://schema.org/Place",
      "name": "http://purl.org/dc/terms/title",
      "alternateName":"http://purl.org/dc/terms/title",
      "description": "http://purl.org/dc/terms/description",
      "geo": "http://schema.org/geo",
      "image":
      {
        "@id": "http://schema.org/image",
        "@type": "@id"
      },
      "latitude":
      {
        "@id": "http://www.w3.org/2003/01/geo/wgs84_pos#lat",
        "@type": "xsd:decimal"
      },
      "longitude":
      {
        "@id": "http://www.w3.org/2003/01/geo/wgs84_pos#long",
        "@type": "xsd:decimal"
      },


      "containedInPlace":"http://schema.org/Place",
      "containsPlace":"http://schema.org/Place",
      "architect":"http://schema.org/Creator",
      "Address": "http://www.w3.org/2006/vcard/ns#Address",
      "address": "http://www.w3.org/2006/vcard/ns#address",
      "street": "http://www.w3.org/2006/vcard/ns#street-address",      
      "locality": "http://www.w3.org/2006/vcard/ns#locality",
      "region": "http://www.w3.org/2006/vcard/ns#region",
      "country": "http://www.w3.org/2006/vcard/ns#country",
      "postalCode": "http://www.w3.org/2006/vcard/ns#postal-code",

      "meter": "http://purl.org/measurement#meter",
      "kilometer": "http://purl.org/measurement#kilometer",
      "feet": "http://purl.org/measurement#feet",
      "miles": "http://purl.org/measurement#miles",

      "xsd": "http://www.w3.org/2001/XMLSchema#"
   }
}

But I am not sure whether google or some other search services will get the idea. 但是我不确定Google还是其他一些搜索服务会理解这个想法。 If you have any improvements or ideas to the schema let me know! 如果您对架构有任何改进或想法,请告诉我!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM