Skip to content

Add menu-position support for sidebar links #50

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

Merged
merged 3 commits into from
Jun 25, 2025

Conversation

rezrah
Copy link
Collaborator

@rezrah rezrah commented Jun 25, 2025

Before After
Screenshot 2025-06-24 at 19 26 08 Screenshot 2025-06-24 at 19 26 14

@Copilot Copilot AI review requested due to automatic review settings June 25, 2025 07:37
@rezrah rezrah requested a review from a team as a code owner June 25, 2025 07:37
Copy link
Contributor

@Copilot 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 support for a menu-position frontmatter field to control sidebar link ordering.

  • Introduces an order field in the FrontMatter type
  • Updates sidebar sorting logic to use menu-position from frontmatter
  • Provides an example MDX file using menu-position and updates the changelog

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/theme/types.ts Added order?: number to FrontMatter to represent custom ordering
packages/theme/components/layout/sidebar/Sidebar.tsx Extended .sort() comparator to prioritize items with menu-position
packages/site/content/content-example/simple.mdx Added menu-position: 1 to example frontmatter
.changeset/real-pumas-boil.md Added changelog entry for menu-position support
Comments suppressed due to low confidence (2)

packages/theme/types.ts:34

  • [nitpick] The name order is ambiguous compared to the menu-position key used elsewhere. Adopting a consistent identifier (e.g., menuPosition) across the type, frontmatter, and code will improve clarity.
  order?: number

packages/theme/components/layout/sidebar/Sidebar.tsx:85

  • The new sorting logic for menu-position isn’t covered by existing tests. Consider adding unit tests for cases with and without menu-position to verify correct ordering.
                .sort((a, b) => {

@rezrah rezrah merged commit 5d67989 into main Jun 25, 2025
8 checks passed
@primer-css primer-css mentioned this pull request Jun 24, 2025
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.

3 participants