【问题标题】:Should the url property in WebSite represent the main page or the current page being rendered?WebSite 中的 url 属性应该代表主页面还是正在呈现的当前页面?
【发布时间】:2020-01-24 00:59:18
【问题描述】:

我正在尝试将微数据添加到我的网站中,以帮助搜索引擎了解我的内容。 WebSite 定义需要一个名为 url 的属性。我对我应该在这里使用哪个 URL 感到困惑。 url 应该是主页面的 URL 还是正在呈现的当前页面?

例如,如果我想为https://example.com/i/12/some-tag 创建微数据。 urlhttps://example.com 还是规范 URL(即 https://example.com/i/12/some-tag)?

【问题讨论】:

  • 请注意,Schema.org 不需要任何属性;该页面列出了所有可以使用的属性,但它们不是必须使用的。 -- 特定的消费者,例如不过,Google 搜索可能对其提供的某些功能有某些要求。

标签: url schema.org


【解决方案1】:

WebSiteurl 应该是网站的主页。

如果您想提供有关当前页面的结构化数据,可以使用WebPage 及其url 属性。

<!-- on https://example.com/i/12/some-tag -->

<body itemscope itemtype="http://schema.org/WebPage">
  <link itemprop="url" href="https://example.com/i/12/some-tag" />

  <div itemprop="isPartOf" itemscope itemtype="https://schema.org/WebSite">
    <link itemprop="url" href="https://example.com/" />
  </div>

</body>

对于主页本身,WebSiteWebPage 将具有相同的 url 值。通过为每个项目提供自己的 URI 作为标识符(通过 Microdata 的 itemid 属性),您可以区分这两个(以及所有其他)项目。 See this answer for details.

【讨论】:

  • 目前我有&lt;html itemscope itemtype="https://schema.org/WebSite"&gt;,添加了你提供的信息后,还需要吗?
  • @Junior:每个文档不应有多个 WebSite 项目。指定哪个元素并不重要(htmlbodydiv 等)。
  • 如果每个文档只能定义一个网站,如何引用您的网页正在谈论的多个网站?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-08-23
  • 2014-02-10
  • 1970-01-01
  • 1970-01-01
  • 2015-05-10
  • 2023-03-25
相关资源
最近更新 更多