Signature
Parameters
URL path to find metadata for (e.g., “/products/all”, “/orders/:id”)Supports:
- Static paths:
/dashboard,/products/list - Dynamic segments:
/orders/:orderId,/products/:slug - Nested paths:
/settings/profile/edit
Returns
Returns an object containing page metadata if found, or
null if the path is external or not foundUsage
Display Current Page Info
Custom Navigation Item
Dynamic Breadcrumbs
Page Title Component
Tab Navigation
How It Works
Path Matching
The hook searches through all registered modules and resources to find a matching path:- Exact matches:
/products/listmatches exactly - Dynamic segments:
/orders/:idmatches/orders/123 - Nested resources: Searches recursively through sub-resources
- External links: Returns
nullfor paths starting withhttp://orhttps://
Title Resolution
Titles are resolved in this order:- Custom
meta.titlefrom module/resource definition - Localized title if using
LocalizedString - Path converted to title case (e.g., “product-list” → “Product List”)
Example Module Definition
Edge Cases
Path Not Found
External URLs
Root Path
Best Practices
- Always check for null: The hook may return
nullfor external links or unknown paths - Provide fallbacks: Display a default title/icon when metadata is not found
- Use with localization: Combine with
defineI18nLabelsfor multi-language support - Cache results: React automatically memoizes hook results, but consider useMemo for expensive operations
Related
- defineModule - Define modules with metadata
- defineResource - Define resources with metadata
- SidebarItem - Uses this hook internally for navigation