【问题标题】:JSON-LD for multiple pages (Course Intro page & Lesson pages) that make up a course构成课程的多个页面(课程介绍页面和课程页面)的 JSON-LD
【发布时间】:2022-06-23 04:52:53
【问题描述】:

我不确定如何标记构成课程的页面。假设我有以下页面,其中每个组中的第一个是课程介绍页面,以下每个页面都是课程中的单个课程页面。从技术上讲,所有页面共同构成了整个课程。该课程完全在线,您可以按照自己的步调进行。

www.myeducationalsite.com/course-1
www.myeducationalsite.com/course-1/lesson-1
www.myeducationalsite.com/course-1/lesson-2
www.myeducationalsite.com/course-1/lesson-3

www.myeducationalsite.com/course-2
www.myeducationalsite.com/course-2/lesson-1
www.myeducationalsite.com/course-2/lesson-2

我正在使用来自 schema.org 的 Course 对象来描述课程介绍页面,但我不确定要为课程页面使用哪种对象类型。

我也不确定如何描述他们的关系。 hasCourseInstance 属性似乎不是我需要的,但也许我误解了。我知道我可以使用 hasPartisPartOf 来描述关系,但我不确定在课程页面上使用什么 @type。

如何使用 JSON-LD 来描述构成课程的页面之间的关系?

【问题讨论】:

    标签: seo schema.org json-ld structured-data


    【解决方案1】:

    浏览 schema.org 站点会发现 hasPart 关系指向 CreativeWork,与您的用例最相关的子类可能是 LearningResource

    所以也许是这样的:

    [
      {
        "@context": "https://schema.org/",
        "@id": "https://www.myeducationalsite.com/course-1",
        "@type": "Course",
        "hasPart": [
          {
            "@type": "LearningResource",
            "@id": "https://www.myeducationalsite.com/course-1/lesson-1"
          },
          {
            "@type": "LearningResource",
            "@id": "https://www.myeducationalsite.com/course-1/lesson-2"
          },
          {
            "@type": "LearningResource",
            "@id": "https://www.myeducationalsite.com/course-1/lesson-3"
          }
        ]
      },
      {
        "@context": "https://schema.org/",
        "@id": "https://www.myeducationalsite.com/course-2",
        "@type": "Course",
        "hasPart": [
          {
            "@type": "LearningResource",
            "@id": "https://www.myeducationalsite.com/course-2/lesson-1"
          },
          {
            "@type": "LearningResource",
            "@id": "https://www.myeducationalsite.com/course-2/lesson-2"
          }
         ]
      }
    ]
    

    Here 是上述 JSON-LD Playground 的链接。

    【讨论】: