fix(page-compiler): add metadata support to breadcrumb items#107
Merged
YusukeHirao merged 7 commits intomainfrom Mar 23, 2026
Merged
fix(page-compiler): add metadata support to breadcrumb items#107YusukeHirao merged 7 commits intomainfrom
YusukeHirao merged 7 commits intomainfrom
Conversation
BreadcrumbItem now includes a `meta` property containing the source page's metaData, consistent with NavNode's `meta` property. The transformItem callback also receives the meta property, enabling metadata-based transformations like redirect URLs. https://claude.ai/code/session_01F4JmMYLB4MbgSJ5rFgGQfQ
- Add JSDoc noting meta is a reference, not a deep copy - Type CompileData.breadcrumbs as BreadcrumbItem<M>[] instead of unknown - Add generic createMockPage helper to eliminate test casts - Add type test for custom MetaData access via transformBreadcrumbItem - Add coverage: empty metaData, baseURL + transformItem combo, titleList compat https://claude.ai/code/session_01F4JmMYLB4MbgSJ5rFgGQfQ
…106) - Update transformBreadcrumbItem docs to reflect meta property and new type signature - Add BreadcrumbItem to API Exports list in README - Fix duplicate JSDoc block on createMockPage test helper https://claude.ai/code/session_01F4JmMYLB4MbgSJ5rFgGQfQ
- Add @template M to all exported generic types and functions in breadcrumbs.ts, types.ts, and page-compiler.ts - Add @param/@returns to ContentHook and CompilerFunction type aliases - Fix @example blocks using old `pageCompiler()` call style to `createPageCompiler()()` to match current API - Update transformBreadcrumbItem example to show meta access https://claude.ai/code/session_01F4JmMYLB4MbgSJ5rFgGQfQ
Revert yarn.lock to match main branch. Remove tsconfig.tsbuildinfo which should not be tracked in version control. https://claude.ai/code/session_01F4JmMYLB4MbgSJ5rFgGQfQ
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.
Summary
This PR adds metadata support to breadcrumb items, allowing access to page metadata (including custom properties) within breadcrumb transformations and enabling more flexible breadcrumb customization.
closes: #106
Key Changes
metaproperty toBreadcrumbItem<M>that contains the source page's metadata, enabling access to custom metadata properties in breadcrumb itemsBreadcrumbItemandGetBreadcrumbsOptionsgeneric over metadata typeMgetBreadcrumbs()function signature to properly propagate metadata typestransformBreadcrumbIteminPageCompilerOptionsto acceptBreadcrumbItem<M>with metadatametaproperty is included in breadcrumb itemstransformItemaccessing custom metadata properties (e.g.,redirectUrl)transformItemandbaseURLcombinationtitleListcompatibility with metadata-enhanced breadcrumbsitem.meta.redirectUrlin transformationsmetais a direct reference (not a deep copy) to source page metadataImplementation Details
metaproperty is populated directly fromsourcePage.metaDataduring breadcrumb creationhttps://claude.ai/code/session_01F4JmMYLB4MbgSJ5rFgGQfQ