如何正确格式化这些丰富的摘要?

发布于 2025-01-04 00:44:44 字数 3960 浏览 1 评论 0 原文

因此,我的下面的代码在输入Google 的丰富网页摘要测试工具时可以正常工作。问题是我不需要将 Venue Name 链接到任何网址。但是,当我取出 a 标记并将该行简化为 Venue Name 时,测试工具会告诉我认为该页面不包含任何丰富的摘要标记。此外,它还发出这样的警告:

Warning: Event urls are pointing to a different domain than the base url.

有没有办法不让场地名称与任何东西关联?

基本上,我只是希望结果看起来像这样(仅链接“购买门票”部分):

2 月 2 日 — 亚利桑那州凤凰城 - Crescent Ballroom - 买票

我已经上传了我正在测试的html文件并进入测试工具这里< /a>.

<div itemscope itemtype="http://schema.org/MusicGroup">

<h1 itemprop="name">Name</h1>

<div itemprop="events" itemscope itemtype="http://schema.org/Event">
  <meta itemprop="startDate" content="2012-02-02">Date &mdash; 
  <span itemprop="location">City, State</span> - 
  <a href="/tour" itemprop="url">
    <span itemprop="name">Venue Name</span>
  </a> - 
  <a href="http://ticketlink.com" itemprop="offers">Buy tickets</a>
</div>

</div>

2/16 - 更新的代码

<div itemscope itemtype="http://schema.org/MusicEvent">

<h1 itemprop="name">Name</h1>

<div itemprop="events" itemscope itemtype="http://schema.org/Event">
  <meta itemprop="startDate" content="2012-02-02">Date &mdash; 
  <span itemprop="location" itemscope itemtype="http://schema.org/Place">
    <span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
      <span itemprop="addressLocality">City</span>,
      <span itemprop="addressRegion">State</span>
    </span>- 
    <span itemprop="name">Venue Name</span> - 
  <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
    <a href="http://ticketlink.com" itemprop="url">Buy tickets</a>
  </div>
  </span>
</div>

</div>

2/17 - 更新的代码

<div itemscope itemtype="http://schema.org/MusicGroup">
    <h1 itemprop="name">Name</h1>

    <div itemprop="events" itemscope itemtype="http://schema.org/MusicEvent">
      <meta itemprop="startDate" content="2012-02-02">Date &mdash; 
      <span itemprop="location" itemscope itemtype="http://schema.org/Place">
        <span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
          <span itemprop="addressLocality">City</span>,
          <span itemprop="addressRegion">State</span>
        </span>- 
        <span itemprop="name">Venue Name</span> - 
        <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
          <a href="http://ticketlink.com" itemprop="url">Buy tickets</a>
        </div>
      </span>
    </div>
</div>

2/17 - 新更新的代码

<div itemscope itemtype="http://schema.org/MusicGroup">
  <h1 itemprop="name">Name</h1>

  <div itemprop="events" itemscope itemtype="http://schema.org/MusicEvent">
    <meta itemprop="startDate" content="2012-02-02">Date &mdash; 
    <span itemprop="location" itemscope itemtype="http://schema.org/Place">
      <span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
        <span itemprop="addressLocality">City</span>,
        <span itemprop="addressRegion">State</span>
      </span>- 
      <span itemprop="name">Venue Name</span> - 
    </span>
    <div itemprop="offers">
      <a href="http://ticketlink.com" itemprop="url">Buy tickets</a>
    </div>
  </div>
</div>

So, I have the code below which works fine when entered into Google's Rich Snippet Testing Tool. The problem is that I don't need the Venue Name linked to any url. However, when I take out the a tag and simplify that line to just <span itemprop="name">Venue Name</span>, the test tool tells me that the page doesn't contain any rich snippet markup. Furthermore, it gives off a warning like this:

Warning: Event urls are pointing to a different domain than the base url.

Is there a way to not have the name of the venue linked to anything?

Basically, I just want the result to look like this (with only the 'buy tickets' part linked):

Feb 2 — Phoenix, AZ - Crescent Ballroom - Buy tickets

I have uploaded the html file that I am testing with and entering into the test tool here.

<div itemscope itemtype="http://schema.org/MusicGroup">

<h1 itemprop="name">Name</h1>

<div itemprop="events" itemscope itemtype="http://schema.org/Event">
  <meta itemprop="startDate" content="2012-02-02">Date — 
  <span itemprop="location">City, State</span> - 
  <a href="/tour" itemprop="url">
    <span itemprop="name">Venue Name</span>
  </a> - 
  <a href="http://ticketlink.com" itemprop="offers">Buy tickets</a>
</div>

</div>

2/16 - updated code

<div itemscope itemtype="http://schema.org/MusicEvent">

<h1 itemprop="name">Name</h1>

<div itemprop="events" itemscope itemtype="http://schema.org/Event">
  <meta itemprop="startDate" content="2012-02-02">Date — 
  <span itemprop="location" itemscope itemtype="http://schema.org/Place">
    <span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
      <span itemprop="addressLocality">City</span>,
      <span itemprop="addressRegion">State</span>
    </span>- 
    <span itemprop="name">Venue Name</span> - 
  <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
    <a href="http://ticketlink.com" itemprop="url">Buy tickets</a>
  </div>
  </span>
</div>

</div>

2/17 - updated code

<div itemscope itemtype="http://schema.org/MusicGroup">
    <h1 itemprop="name">Name</h1>

    <div itemprop="events" itemscope itemtype="http://schema.org/MusicEvent">
      <meta itemprop="startDate" content="2012-02-02">Date — 
      <span itemprop="location" itemscope itemtype="http://schema.org/Place">
        <span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
          <span itemprop="addressLocality">City</span>,
          <span itemprop="addressRegion">State</span>
        </span>- 
        <span itemprop="name">Venue Name</span> - 
        <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
          <a href="http://ticketlink.com" itemprop="url">Buy tickets</a>
        </div>
      </span>
    </div>
</div>

2/17 - new updated code

<div itemscope itemtype="http://schema.org/MusicGroup">
  <h1 itemprop="name">Name</h1>

  <div itemprop="events" itemscope itemtype="http://schema.org/MusicEvent">
    <meta itemprop="startDate" content="2012-02-02">Date — 
    <span itemprop="location" itemscope itemtype="http://schema.org/Place">
      <span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
        <span itemprop="addressLocality">City</span>,
        <span itemprop="addressRegion">State</span>
      </span>- 
      <span itemprop="name">Venue Name</span> - 
    </span>
    <div itemprop="offers">
      <a href="http://ticketlink.com" itemprop="url">Buy tickets</a>
    </div>
  </div>
</div>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一个人的旅程 2025-01-11 00:44:44

我在这里注意到一些事情。

  1. 除非,我误解,这是一个音乐活动,所以您可能应该使用更具体的 itemtype="http://schema.org/MusicEvent"。

  2. “location”itemprop 还需要是 http://schema.org/Place 的 itemtype或http://schema.org/PostalAddress。这也将解决您的 name itemprop 问题。例如:

    城市,
        状态
      
      场地名称
    
    

    请参阅我的下一点,了解为什么我省略了 url itemprop。

  3. Offers 属性是另一种项目类型,因此您需要如下所示的属性:

    预售门票

    但是,我不完全确定您可以在 url itemprop 中拥有指向另一个域的链接。这是没有记录的,但我还没有看到这样的例子。您可能需要省略 Offer itemprop,只让 Google 从 Ticketlink 本身引入票证信息。

  4. 请参阅我的回答您的另一个问题是关于您尝试复制的这些丰富网页摘要链接实际上是如何填充在搜索结果中的。

更新:这是通过测试工具的最终代码片段

<div itemscope itemtype="http://schema.org/MusicGroup">
  <h1 itemprop="name">Name</h1>

  <div itemprop="events" itemscope itemtype="http://schema.org/MusicEvent">
    <meta itemprop="startDate" content="2012-02-02">Date — 
    <span itemprop="name">Event Name</span>        
    <span itemprop="location" itemscope itemtype="http://schema.org/Place">
      <span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
        <span itemprop="addressLocality">City</span>,
        <span itemprop="addressRegion">State</span>
      </span>- 
      <span itemprop="name">Venue Name</span> - 
    </span>
    <a href="http://ticketlink.com" itemprop="offers">Buy tickets</a>
  </div>
</div>

There a few things I am noticing here.

  1. Unless, I misunderstand, this is a music event, so you should probably use the more specific itemtype="http://schema.org/MusicEvent".

  2. The "location" itemprop also needs to be an itemtype of http://schema.org/Place or http://schema.org/PostalAddress. This will also solve your name itemprop issue. So for example:

    <span itemprop="location" itemscope itemtype="http://schema.org/Place>
      <span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress>
        <span itemprop="addressLocality">City</span>,
        <span itemprop="addressRegion">State</span>
      </span>
      <span itemprop="name">Venue Name</span>
    </span>
    

    See my next point on why I left out the url itemprop.

  3. The offers property is another itemtype, so you'll want something like this:

    <div itemprop="offers" itemscope itemtype="http://schema.org/Offer>
      <a href="http://ticketlink.com" itemprop="url">Presale tickets</a>
    </div>
    

    However, I'm not entirely sure that you can have a link to another domain in a url itemprop. This is undocumented but I've yet to see an example of one that does. You may need to leave out the offer itemprop and just let Google bring in ticket information from ticketlink themselves.

  4. Please see my answer to your other question about how these rich snippet links you're trying to reproduce are actually being populated in search results.

UPDATE: Here is the final code snippet that passes the Testing Tool

<div itemscope itemtype="http://schema.org/MusicGroup">
  <h1 itemprop="name">Name</h1>

  <div itemprop="events" itemscope itemtype="http://schema.org/MusicEvent">
    <meta itemprop="startDate" content="2012-02-02">Date — 
    <span itemprop="name">Event Name</span>        
    <span itemprop="location" itemscope itemtype="http://schema.org/Place">
      <span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
        <span itemprop="addressLocality">City</span>,
        <span itemprop="addressRegion">State</span>
      </span>- 
      <span itemprop="name">Venue Name</span> - 
    </span>
    <a href="http://ticketlink.com" itemprop="offers">Buy tickets</a>
  </div>
</div>
子栖 2025-01-11 00:44:44

我和你有同样的问题。我觉得格式没问题;然而,Google 似乎以某种方式“标记”了 URL 与页面托管域不同的事件列表。我刚刚在我管理的一个网站中注意到这个问题。

我已经联系谷歌询问此事,看看问题出在哪里。在极不可能有真人回复我的查询的情况下,我将在这里用更多信息更新我的答案。

I had the same problem as you. The formatting looks okay to me; however, it appears that Google is somehow "flagging" event listings where the URL is different from the domain the page is hosted on. I just noticed this problem in a site I manage as well.

I have contacted Google about this to see what the problem is. In the exceedingly unlikely chance that an actual human replies to my query, I will update my answer here with more information.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文