【问题标题】:Using Schema.org itemprop on Facebook OG meta tags在 Facebook OG 元标记上使用 Schema.org itemprop
【发布时间】:2014-07-16 22:27:14
【问题描述】:

现在我正在使用 itemprop COMBINED 与 Facebook Open Graph <meta> 标签,如下所示:

<html class="no-js" itemscope="itemscope" itemtype="http://schema.org/WebPage">
   // ...
  <meta property="og:type" content="website" /> 
  <meta itemprop="name" property="og:title" content="My Title" />
  <meta itemprop="image" property="og:image" content="http://example.com/socialimage.jpg" />
  <meta itemprop="url" property="og:url" content="http://example.com" />
  <meta itemprop="description" property="og:description" content="My description" />
  <meta property="og:site_name" content="My Site"/>

这样做可以接受/有效吗?

【问题讨论】:

    标签: facebook-opengraph meta schema.org microdata rdfa


    【解决方案1】:

    看起来它会起作用,但为了让您知道,Google 的政策是忽略隐藏标记。所以,请记住一些事情。

    【讨论】:

      【解决方案2】:

      itemprop 由 Microdata 定义,property 由 RDFa 定义。所以你的问题是:Microdata 和 RDFa 可以用在同一个 meta 元素上吗?

      是的,我有explained in a similar (but not identical) question

      meta 上使用微数据时,不允许使用以下属性:namehttp-equivcharset。在meta 上使用RDFa 时,这三个属性是可选的。在这两种情况下,content 属性都是必需的。


      请注意,您可以停止使用 Microdata 并为 Schema.org 使用 RDFa:

      <html typeof="schema:WebPage">
        <!-- … -->
        <meta property="og:type" content="website" /> 
        <meta property="og:title schema:name" content="My Title" />
        <meta property="og:image schema:image" content="http://example.com/socialimage.jpg" />
        <meta property="og:url schema:url" content="http://example.com" />
        <meta property="og:description schema:description" content="My description" />
        <meta property="og:site_name" content="My Site"/>
      

      另请注意,当值为 URL 时,应使用 link 而不是 meta

        <meta property="og:type" content="website" /> 
        <meta property="og:title schema:name" content="My Title" />
        <link property="og:image schema:image" href="http://example.com/socialimage.jpg" />
        <link property="og:url schema:url" href="http://example.com" />
        <meta property="og:description schema:description" content="My description" />
        <meta property="og:site_name" content="My Site"/>
      

      【讨论】:

      【解决方案3】:

      在您的头文件中尝试以下整个代码: Schema 数据的脚本代码:

      <script type='application/ld+json'>
              {
                  "@context": "http://www.schema.org",
                  "@type": "LocalBusiness",
                  "name": "website",
                  "url": "http://www.website.com/",
                  "logo": "http://www.website.com/images/logo.png",
                  "image": "http://www.website.com/images/dhaka-city.jpg",
                  "title": "Title of your website | website.com",
                  "description": "website.com is your online business directory of Country",
                  "address": {
                      "@type": "PostalAddress",
                      "streetAddress": "Road #21, Gulshan, Dhaka, Bangladesh ",
                      "addressLocality": "Gulshan",
                      "addressRegion": "Dhaka",
                      "postalCode": "1200",
                      "addressCountry": "Bangladesh"
                  },
                  "telephone": "+880123456789",
                  "geo": {
                      "@type": "GeoCoordinates",
                      "latitude": "23.783127",
                      "longitude": "90.394359"
                  },
                  "openingHours": "Su, Mo, Tu, We, Th, Fr 09:00-18:00",
                  "contactPoint": {
                      "@type": "ContactPoint",
                      "contactType": "Customer support & query",
                      "telephone": "+880123456789"
                  }
              }
          </script>
      

      Twitter 的 Schema.org 标记:

      <meta name="twitter:card" content="summary">
      <meta name="twitter:site" content="@website">
      <meta name="twitter:creator" content="@website">
      <meta property="twitter:url" content="http://www.website.com/" />
      <meta name="twitter:title" content="Title of your website | website.com">
      <meta name="twitter:description" content="website.com is your online business directory of Country">
      <meta name="twitter:image" content="http://www.website.com/images/dhaka-city.jpg">
      

      打开图表数据:

      <meta property="og:title" content="Title of your website | website.com"/>
      <meta property="og:type" content="Most popular business directory of Bangladesh"/>
      <meta property="og:url" content="http://www.website.com/"/>
      <meta property="og:image" content="http://www.website.com/images/dhaka-city.jpg"/>
      <meta property="og:site_name" content="@website"/>
      <meta property="fb:admins" content="Author"/>
      <meta property="og:description" content="website.com is your online business directory of Country"/>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-12-24
        • 2018-02-22
        • 2017-03-31
        • 1970-01-01
        • 2015-07-16
        • 1970-01-01
        • 2012-07-21
        相关资源
        最近更新 更多