Skip to content

Add menu-position support for sidebar links - #50

Merged
rezrah merged 3 commits into
mainfrom
rezrah/add-menu-page-ordering-in-groups
Jun 25, 2025
Merged

Add menu-position support for sidebar links#50
rezrah merged 3 commits into
mainfrom
rezrah/add-menu-page-ordering-in-groups

Conversation

@rezrah

@rezrah rezrah commented Jun 25, 2025

Copy link
Copy Markdown
Collaborator
Before After
Screenshot 2025-06-24 at 19 26 08 Screenshot 2025-06-24 at 19 26 14

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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) => {

Comment thread packages/theme/types.ts Outdated
@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.

4 participants