You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用schema.org在同一页面引用已定义的LocalBusiness条目?

Answer

Absolutely! You can totally eliminate that redundant LocalBusiness definition by using JSON-LD's @id property to create a single shared entry for your yoga studio, then referencing it in both Event listings. This keeps your code DRY (Don't Repeat Yourself) and ensures consistency across all your events.

How It Works

  1. Define your business once: Create a single LocalBusiness object with a unique @id (we’ll use a fragment like #hello-yoga-studio for simplicity—this just needs to be unique on your page).
  2. Reference it in each event: Instead of retyping the entire business object under performer, just point to the @id you created. Schema parsers will automatically link the event to your shared business entry.

Updated JSON-LD Code

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@graph": [
    {
      "@type": "LocalBusiness",
      "@id": "#hello-yoga-studio",
      "description": "Small, friendly yoga classes. Suitable for all abilities. Strengthen body, increase flexibility and calm the mind.",
      "name": "hello YOGA",
      "email": "clare@hello-yoga.co.uk",
      "url": "https://www.hello-yoga.co.uk",
      "priceRange": "£7",
      "image": "https://www.hello-yoga.co.uk/yoga-people.svg",
      "address": {
        "@type": "PostalAddress",
        "addressLocality": "Harrogate",
        "addressRegion": "North Yorkshire",
        "addressCountry": "GB"
      }
    },
    {
      "@type": "Event",
      "name": "hello YOGA",
      "startDate": "2018-06-13T19:45",
      "endDate": "2018-06-13T20:45",
      "description": "Yoga class at Friends Meeting House (Harrogate) every Thursday.",
      "image": "https://www.hello-yoga.co.uk/yoga-people.svg",
      "location": {
        "@type": "Place",
        "name": "Friends Meeting House",
        "address": {
          "@type": "PostalAddress",
          "streetAddress": "12A Queens Parade",
          "addressLocality": "Harrogate",
          "addressRegion": "North Yorkshire",
          "postalCode": "HG1 5PP",
          "addressCountry": "GB"
        }
      },
      "offers": {
        "@type": "Offer",
        "availability": "http://schema.org/LimitedAvailability",
        "price": "7.00",
        "priceCurrency": "GBP",
        "validFrom": "2018-05-01T12:00",
        "url": "https://www.hello-yoga.co.uk"
      },
      "potentialAction": {
        "@type": "ExerciseAction",
        "name": "hello YOGA",
        "description": "Small, friendly yoga class. Suitable for all abilities.",
        "exerciseType": "Yoga",
        "startTime": "2018-06-13T19:45",
        "endTime": "2018-06-13T20:45",
        "location": {
          "name": "Friends Meeting House",
          "@type": "PostalAddress",
          "streetAddress": "12A Queens Parade",
          "addressLocality": "Harrogate",
          "addressRegion": "North Yorkshire",
          "postalCode": "HG1 5PP",
          "addressCountry": "GB"
        }
      },
      "performer": {"@id": "#hello-yoga-studio"}
    },
    {
      "@type": "Event",
      "name": "hello YOGA",
      "startDate": "2018-06-07T19:00",
      "endDate": "2018-06-07T20:00",
      "description": "Yoga class at Beckwith Health Club (Harrogate) every Wednesday.",
      "image": "https://www.hello-yoga.co.uk/yoga-people.svg",
      "location": {
        "@type": "Place",
        "name": "Beckwith Health Club",
        "address": {
          "@type": "PostalAddress",
          "streetAddress": "Beckwith Health Club",
          "addressLocality": "Harrogate",
          "addressRegion": "North Yorkshire",
          "postalCode": "HG3 1UF",
          "addressCountry": "GB"
        }
      },
      "offers": {
        "@type": "Offer",
        "availability": "http://schema.org/LimitedAvailability",
        "price": "7.00",
        "priceCurrency": "GBP",
        "validFrom": "2018-05-01T12:00",
        "url": "https://www.hello-yoga.co.uk"
      },
      "potentialAction": {
        "@type": "ExerciseAction",
        "name": "hello YOGA",
        "description": "Small, friendly yoga class. Suitable for all abilities.",
        "exerciseType": "Yoga",
        "startTime": "2018-06-07T19:00",
        "endTime": "2018-06-07T20:00",
        "location": {
          "name": "Beckwith Health Club",
          "@type": "PostalAddress",
          "streetAddress": "Beckwith Health Club",
          "addressLocality": "Harrogate",
          "addressRegion": "North Yorkshire",
          "postalCode": "HG3 1UF",
          "addressCountry": "GB"
        }
      },
      "performer": {"@id": "#hello-yoga-studio"}
    }
  ]
}
</script>

Quick Tips

  • We wrapped everything in an @graph array to keep all schema entities in one script—this makes it easier for search engines and parsers to recognize the relationships between your business and events.
  • The @id can be any unique value, but using a fragment identifier (like #hello-yoga-studio) is a simple, standard approach for page-internal references.
  • Now, if you need to update your business details (like email or description), you only have to edit one spot instead of two—win-win!

内容的提问来源于stack exchange,提问作者Mike

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 07:31:39