Skip to content

Commit 1d2df64

Browse files
committed
chore(site): add a site name with structured data
1 parent 2b5af95 commit 1d2df64

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

site/src/lib/schema.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export function buildSchemas(route: StarlightRouteData) {
1414
const isDocPage = !isHomepage;
1515

1616
if (isHomepage) {
17+
schemas.push(buildWebSiteSchema());
1718
schemas.push(buildPersonSchema());
1819
schemas.push(buildSoftwareApplicationSchema());
1920
}
@@ -26,6 +27,20 @@ export function buildSchemas(route: StarlightRouteData) {
2627
return schemas;
2728
}
2829

30+
/**
31+
* WebSite schema for homepage (for Google site name feature).
32+
* https://schema.org/WebSite
33+
* https://developers.google.com/search/docs/appearance/site-names
34+
*/
35+
function buildWebSiteSchema() {
36+
return {
37+
"@context": "https://schema.org",
38+
"@type": "WebSite",
39+
name: siteConfig.siteName,
40+
url: siteConfig.siteUrl,
41+
};
42+
}
43+
2944
/**
3045
* Person schema for homepage (Jamie Mason as author).
3146
* https://schema.org/Person

0 commit comments

Comments
 (0)