网站首页的Schema结构化数据优化方案,主要包括三部分:
首页的结构化数据加上Website,Webpage和Organization网站组织信息
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@graph": [
{
"@type": "WebSite",
"@id": "https://www.example.com#website",
"url": "https://www.example.com",
"name": "example",
"inLanguage": "en-US",
"publisher": {
"@id": "https://www.example.com#identity"
},
"potentialAction": [{
"@type": "SearchAction",
"target": "https://www.example.com/search?q={search_term_string}",
"query-input": "required name=search_term_string"
}]
},
{
"@type": "WebPage",
"@id": "https://www.example.com#webpage",
"url": "https://www.example.com",
"name": "example",
"description": "example",
"about": {
"@id": "https://www.example.com#identity"
},
"isPartOf": {
"@type": "WebSite",
"@id": "https://www.example.com#website"
}
},
{
"@type": "Organization",
"@id": "https://www.example.com#identity",
"name": "example",
"url": "https://www.example.com",
"logo": "https://www.example.com/logo.png",
"description": "example",
"sameAs": [
"https://www.facebook.com/people/example/61566438561692/",
"https://www.instagram.com/example/",
"https://x.com/example",
"https://www.youtube.com/@example",
"https://www.pinterest.com/example/",
"https://discord.gg/example",
"https://www.reddit.com/user/example"
],
"contactPoint": [{
"@type": "ContactPoint",
"telephone": "+1(347)123-4567",
"contactType": "customer service",
"areaServed": "US",
"email": "support@example.com",
"url": "https://www.example.com/contact-us.html",
"availableLanguage": ["English"]
}]
}
]
}
</script>
这段代码是用于 SEO 的 Schema.org 结构化数据标记,它告诉搜索引擎:
“这个网站是谁、主页是哪一页、怎么搜索、联系方式在哪”等等~ 它让搜索结果更漂亮(比如带 logo、搜索框、社交链接之类的~)
下面我来分模块讲👇
"@context": "https://schema.org/",
"@graph": [ ... ]
@context: 告诉搜索引擎这是遵循 Schema.org 的标准语义。@graph: 表示这是一组互相关联的实体对象,可以理解成“一个网站的信息网络”。{
"@type": "WebSite",
"@id": "https://www.example.com#website",
"url": "https://www.example.com",
"name": "example",
"inLanguage": "en-US",
"publisher": { "@id": "https://www.example.com#identity" },
"potentialAction": [{
"@type": "SearchAction",
"target": "https://www.example.com/search?q={search_term_string}",
"query-input": "required name=search_term_string"
}]
}
功能:
SearchAction 会在 Google 搜索结果页中显示一个站内搜索框(很高级的那种搜索条!){
"@type": "WebPage",
"@id": "https://www.example.com#webpage",
"url": "https://www.example.com",
"name": "example",
"description": "example",
"about": { "@id": "https://www.example.com#identity" },
"isPartOf": { "@id": "https://www.example.com#website" }
}
功能:
isPartOf:说明它属于上面的 WebSite。about:说明这个网页是关于哪个组织(Organization)。{
"@type": "Organization",
"@id": "https://www.example.com#identity",
"name": "example",
"url": "https://www.example.com",
"logo": "https://www.example.com/logo.png",
"description": "example",
"sameAs": [ ... ],
"contactPoint": [{
"@type": "ContactPoint",
"telephone": "+1(347)123-4567",
"contactType": "customer service",
"areaServed": "US",
"email": "support@example.com",
"url": "https://www.example.com/contact-us.html",
"availableLanguage": ["English"]
}]
}
功能:
sameAs:告诉搜索引擎哪些社交媒体是官方的(帮助聚合品牌资料)。contactPoint:列出官方联系方式,常被用于显示在“知识面板”中。| 模块 | 类型 | 用途 |
|---|---|---|
| WebSite | 网站层级 | 定义网站基本信息和站内搜索 |
| WebPage | 页面层级 | 描述当前网页内容 |
| Organization | 组织层级 | 品牌、logo、社交账号、联系方式 |

这是我的小小角落,记录代码、生活和灵感碎片 💻🍃。 我喜欢探索前端的无限可能,也会偶尔写写随笔~ 希望这里能成为我们交流与分享的温暖空间 💖。