Add menu-position support for sidebar links - #50
Merged
Conversation
rezrah
commented
Jun 25, 2025
Collaborator
| Before | After |
|---|---|
|
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for a menu-position frontmatter field to control sidebar link ordering.
- Introduces an
orderfield in theFrontMattertype - Updates sidebar sorting logic to use
menu-positionfrom frontmatter - Provides an example MDX file using
menu-positionand 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
orderis ambiguous compared to themenu-positionkey 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-positionisn’t covered by existing tests. Consider adding unit tests for cases with and withoutmenu-positionto verify correct ordering.
.sort((a, b) => {
joshfarrant
approved these changes
Jun 25, 2025
danielguillan
approved these changes
Jun 25, 2025
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.