Skip to content

Conversation

@moonmeister
Copy link
Member

@moonmeister moonmeister commented Jun 25, 2025

Adds recommendations to the bottom of Docs pages (NOT /docs/ or docs categories e.g. /docs/reference/)

image

Current tag colors:
image

TODO

  • finalize styling
  • choose type tag colors more in line with theme (purple, pink, etc)
  • @ToughCrab24 verify bug in recommendations config has been fixed
  • Animations? fade in?
  • Implement google Analytics event tracking for recommendations links
  • refactor mdx_docs to use the same field names as WP. It solves some problems!

@headless-platform-by-wp-engine

This comment was marked as outdated.

@headless-platform-by-wp-engine

This comment was marked as outdated.

@headless-platform-by-wp-engine

This comment was marked as outdated.

@headless-platform-by-wp-engine

This comment was marked as outdated.

@headless-platform-by-wp-engine

This comment was marked as outdated.

@moonmeister moonmeister marked this pull request as ready for review July 1, 2025 18:20
@headless-platform-by-wp-engine

This comment was marked as outdated.

@headless-platform-by-wp-engine

This comment was marked as outdated.

@headless-platform-by-wp-engine

This comment was marked as outdated.

@headless-platform-by-wp-engine

This comment was marked as outdated.

@moonmeister moonmeister mentioned this pull request Jul 9, 2025
11 tasks
@moonmeister moonmeister reopened this Jul 10, 2025
@headless-platform-by-wp-engine

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-feat-recomendations https://hp…wered.com ✅ (logs)

Learn more about preview environments in our documentation.

@headless-platform-by-wp-engine

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-feat-recomendations https://hp…wered.com ✅ (logs)

Learn more about preview environments in our documentation.

@moonmeister moonmeister enabled auto-merge July 10, 2025 20:16
Copy link
Contributor

Copilot AI left a 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/hi2 across multiple components
  • Implement /api/recommend endpoint and DocsRecommended component
  • Add generateDocIdFromUri and use normalizeSmartSearchResponse for 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.Inter constant is invalid. Use StatusCodes.INTERNAL_SERVER_ERROR for a 500 response.
			.status(StatusCodes.Inter)

src/components/docs-layout.jsx:111

  • The slug variable isn't defined in this component's props. Destructure slug from the page props or derive it via router to avoid runtime errors.
						slug.length > 1 && (

src/components/primary-nav.jsx:95

  • size-6 is 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.hash function may not be available as imported; consider using createHash('sha1').update(uri).digest('hex') to generate a hash.
	return `mdx:${hash("sha-1", uri)}`;

@headless-platform-by-wp-engine

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-feat-recomendations https://hp…wered.com ✅ (logs)

Learn more about preview environments in our documentation.

Copy link
Collaborator

@kellenmace kellenmace left a 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;
Copy link
Collaborator

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?

@moonmeister moonmeister merged commit 29d35f5 into main Jul 10, 2025
4 checks passed
@moonmeister moonmeister deleted the feat-recomendations branch July 10, 2025 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants