feat(docs): add JSON-LD structured data for rich snippets#7484
feat(docs): add JSON-LD structured data for rich snippets#7484aidankmcalister merged 4 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughAdds two new structured-data components, Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. No actionable comments were generated in the recent review. 🎉 Comment |
🍈 Lychee Link Check Report3660 links: ✅ All links are working!Full Statistics Table
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@apps/docs/src/components/structured-data.tsx`:
- Around line 78-83: The BreadcrumbSchema JSON-LD currently omits the same '<'
escaping used by TechArticleSchema, which can allow a slug like "</script>" to
break out of the JSON block; when producing the schema string for
dangerouslySetInnerHTML (the schema variable used in the return with
dangerouslySetInnerHTML), serialize and then escape '<' characters (e.g.,
replace(/</g, '\\u003c')) so BreadcrumbSchema matches TechArticleSchema's
escaping approach and apply this to any code paths that set schema before
rendering.
🧹 Nitpick comments (1)
apps/docs/src/components/structured-data.tsx (1)
62-70: Breadcrumb names use sentence case rather than title case.The current transformation converts
getting-startedto"Getting started"(only first character capitalized). Breadcrumb schemas often use title case like"Getting Started". This is a stylistic choice, but title case tends to look more polished in rich snippets.✨ Optional: Title case transformation
page.slugs.forEach((slug, index) => { currentPath += `/${slug}`; breadcrumbItems.push({ '@type': 'ListItem', position: index + 2, - name: slug.charAt(0).toUpperCase() + slug.slice(1).replace(/-/g, ' '), + name: slug + .split('-') + .map(word => word.charAt(0).toUpperCase() + word.slice(1)) + .join(' '), item: `${baseUrl}${currentPath}`, }); });
Added TechArticle and BreadcrumbList JSON-LD schemas to all documentation pages for Google rich snippet eligibility.
Changes:
structured-data.tsxcomponentTest:
Summary by CodeRabbit