-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Implement recommendations for docs #339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…k html to be more semantic and re-usable
…ently formatted results
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
…d spinner to recommendations
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
…gation so intersectiojn observer works
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
Check out the recent updates to your Headless Platform preview environment:
Learn more about preview environments in our documentation. |
|
Check out the recent updates to your Headless Platform preview environment:
Learn more about preview environments in our documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a recommendations panel to documentation pages and standardizes icon usage across the site using react-icons/hi2. It also refactors the search and recommendation APIs to use a shared response normalizer and introduces a document ID generator for MDX pages.
- Swap out Heroicons for
react-icons/hi2across multiple components - Implement
/api/recommendendpoint andDocsRecommendedcomponent - Add
generateDocIdFromUriand usenormalizeSmartSearchResponsefor search/recommendation responses
Reviewed Changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/pages/showcase/index.jsx | Updated icon import/component to React Icons |
| src/pages/index.jsx | Replaced Heroicons imports with React Icons |
| src/pages/docs/[[...slug]].jsx | Added generateDocIdFromUri, updated doc props |
| src/pages/blog/index.jsx | Swapped Heroicons for React Icons |
| src/pages/api/search.js | Removed custom path cleaning logic, used normalizer |
| src/pages/api/recommend.js | New recommend API route |
| src/lib/smart-search.mjs | New normalizer and config export |
| src/lib/remote-mdx-files.mjs | Added generateDocIdFromUri |
| src/components/search/* | Unified icon imports and updated href handling |
| src/components/primary-nav.jsx | Swapped Heroicons for React Icons |
| src/components/link.jsx | Replaced external link icon with React Icon |
| src/components/heading.jsx | Updated link icon to React Icon |
| src/components/header.jsx | Swapped simple-icons import for React Icons |
| src/components/docs-recommendations.jsx | New recommendations UI component |
| src/components/docs-layout.jsx | Inserted Recommendations into docs layout |
| src/components/docs-breadcrumbs.jsx | Updated breadcrumb icon and added className prop |
| scripts/smart-search.mjs | Refactored indexing script to use new ID and config |
| package.json | Removed Heroicons deps, added react-icons, intersection-observer |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (4)
src/pages/api/recommend.js:68
- The
StatusCodes.Interconstant is invalid. UseStatusCodes.INTERNAL_SERVER_ERRORfor a 500 response.
.status(StatusCodes.Inter)
src/components/docs-layout.jsx:111
- The
slugvariable isn't defined in this component's props. Destructureslugfrom the page props or derive it via router to avoid runtime errors.
slug.length > 1 && (
src/components/primary-nav.jsx:95
size-6is not a valid Tailwind utility. Replace with explicit height/width classes (e.g.,h-6 w-6).
<HiOutlineXMark className="hidden size-6 group-data-open:block" />
src/lib/remote-mdx-files.mjs:170
- The Node
crypto.hashfunction may not be available as imported; consider usingcreateHash('sha1').update(uri).digest('hex')to generate a hash.
return `mdx:${hash("sha-1", uri)}`;
|
Check out the recent updates to your Headless Platform preview environment:
Learn more about preview environments in our documentation. |
kellenmace
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks for implementing this! 👍🏼
| return; | ||
| } | ||
|
|
||
| const theType = type.type || type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems weird that the type could be nested one level (type.type) or it could just be the top-level type. Is there a way to make the format the same, or are they necessarily different?
Adds recommendations to the bottom of Docs pages (NOT /docs/ or docs categories e.g. /docs/reference/)
Current tag colors:

TODO
Animations? fade in?