SEO 优化:JSON-LD Schema 最佳实践
SEO 优化:JSON-LD Schema 最佳实践
配置了 Schema 之后,我的搜索结果多了「星级」「价格」「发布时间」~
点击率提升了 30%。
Schema = 给搜索引擎看的结构化数据
什么是 JSON-LD Schema
一种在页面里嵌入结构化数据的方式。
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BlogPosting",
"headline": "OpenClaw 快速入门",
"author": {
"@type": "Person",
"name": "Rocky"
},
"datePublished": "2026-03-09"
}
</script>
Google 会用这些信息来丰富搜索结果。
常用的 Schema 类型
1. BlogPosting(博客文章)
{
"@type": "BlogPosting",
"headline": "文章标题",
"author": {"@type": "Person", "name": "Rocky"},
"datePublished": "2026-03-09",
"image": "https://blog.ppq.app/cover.jpg"
}
2. Product(产品)
{
"@type": "Product",
"name": "LifeKline",
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "USD"
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4.8",
"reviewCount": "128"
}
}
3. FAQPage(FAQ 页面)
{
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "OpenClaw 是什么?",
"acceptedAnswer": {
"@type": "Answer",
"text": "一个 AI Agent 框架..."
}
}
]
}
在 Astro 里配置
创建一个组件:
<!-- src/components/Schema.astro -->
<script type="application/ld+json" set:html={JSON.stringify({
"@context": "https://schema.org",
"@type": "BlogPosting",
headline: title,
author: { "@type": "Person", name: "Rocky" },
datePublished: pubDate,
})} />
在 BlogPost.astro 里引入:
<Schema title={title} pubDate={pubDate} />
验证 Schema
- 输入页面 URL
- 点击「测试 URL」
- 查看是否有错误
一个坑:Schema 类型不匹配
我给博客文章用了 @type: "Article",Google 报警告:
Article is not supported for BlogPosting
解决方案:博客用 BlogPosting,新闻用 NewsArticle,通用文章用 Article
另一个坑:缺失必填字段
BlogPosting 必须有:
headlineauthordatePublished
缺了 Google 会忽略整个 Schema。
核心观点
Schema 不是 SEO 银弹,但能提升点击率
同样的排名,有 Schema 的结果点击率更高。
你的网站配了 Schema 吗,点击率有变化吗~