You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

如何为博客分类应用Schema.org Schema?技术咨询

为博客分类页应用Schema.org标记的方案

嘿,我来帮你搞定博客分类页的Schema标记问题!其实Schema.org里有几个非常适配的类型,我整理了两种最常用的落地方案,附代码示例供你参考:

方案1:使用CollectionPage + ItemList(首推)

分类页本质是展示同一主题下的文章集合,CollectionPage专门用来定义这类集合型页面,搭配ItemList来结构化列出分类下的博客文章,能让搜索引擎清晰识别页面性质和核心内容:

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "CollectionPage",
  "name": "技术教程分类",
  "description": "这里分享各类编程开发、技术架构相关的原创教程文章",
  "breadcrumb": {
    "@type": "BreadcrumbList",
    "itemListElement": [
      {
        "@type": "ListItem",
        "position": 1,
        "name": "首页",
        "item": "/"
      },
      {
        "@type": "ListItem",
        "position": 2,
        "name": "技术教程",
        "item": "/category/tech-tutorials/"
      }
    ]
  },
  "mainEntity": {
    "@type": "ItemList",
    "itemListElement": [
      {
        "@type": "BlogPosting",
        "position": 1,
        "name": "JavaScript异步编程全解析",
        "description": "从回调到Promise再到Async/Await,彻底搞懂JS异步",
        "url": "/posts/js-async-guide/",
        "datePublished": "2024-01-15",
        "author": {
          "@type": "Person",
          "name": "你的名字"
        }
      },
      {
        "@type": "BlogPosting",
        "position": 2,
        "name": "React Hooks最佳实践",
        "description": "避免常见的Hooks使用误区,写出更优雅的React代码",
        "url": "/posts/react-hooks-best-practices/",
        "datePublished": "2024-01-10",
        "author": {
          "@type": "Person",
          "name": "你的名字"
        }
      }
      // 按需添加更多分类下的文章
    ]
  }
}
</script>

方案2:结合Blog类型

如果你的博客全站已经使用Blog做了整体标记,也可以在分类页里明确关联对应分类,并直接列出归属该分类的文章:

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Blog",
  "name": "我的技术博客",
  "description": "分享编程、技术思考与开发经验",
  "blogPost": [
    {
      "@type": "BlogPosting",
      "name": "JavaScript异步编程全解析",
      "description": "从回调到Promise再到Async/Await,彻底搞懂JS异步",
      "url": "/posts/js-async-guide/",
      "datePublished": "2024-01-15",
      "author": {
        "@type": "Person",
        "name": "你的名字"
      }
    },
    {
      "@type": "BlogPosting",
      "name": "React Hooks最佳实践",
      "description": "避免常见的Hooks使用误区,写出更优雅的React代码",
      "url": "/posts/react-hooks-best-practices/",
      "datePublished": "2024-01-10",
      "author": {
        "@type": "Person",
        "name": "你的名字"
      }
    }
  ],
  "breadcrumb": {
    "@type": "BreadcrumbList",
    "itemListElement": [
      {
        "@type": "ListItem",
        "position": 1,
        "name": "首页",
        "item": "/"
      },
      {
        "@type": "ListItem",
        "position": 2,
        "name": "技术教程",
        "item": "/category/tech-tutorials/"
      }
    ]
  }
}
</script>

几个关键注意点:

  • 务必加上breadcrumb标记,帮助搜索引擎理解网站层级结构,提升分类页的收录权重
  • 每篇文章的BlogPosting标记要包含核心字段:标题、链接、发布日期、作者,这些都是搜索引擎重点抓取的信息
  • 如果分类页有分页,可以在ItemList里添加nextItem/previousItem来关联前后分页页面,强化页面间的关联关系

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

火山引擎 最新活动