mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-25 04:20:02 +00:00
UI: Fix relative file href with hash
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'fumadocs-ui': patch
|
||||
---
|
||||
|
||||
Fix relative file href with hash
|
||||
@@ -21,7 +21,9 @@ fumadocs-ui fumadocs-core
|
||||
|
||||
### 2. Content Source
|
||||
|
||||
Fumadocs supports different content sources, there's how you configure Fumadocs MDX:
|
||||
Fumadocs supports different content sources, including Fumadocs MDX and [Content Collections](/docs/headless/content-collections).
|
||||
|
||||
Fumadocs MDX is our official content source, you can configure it with:
|
||||
|
||||
```package-install
|
||||
fumadocs-mdx @types/mdx
|
||||
|
||||
@@ -18,7 +18,12 @@ export function createRelativeLink(
|
||||
// resolve relative href
|
||||
if (href && href.startsWith('.')) {
|
||||
const target = source.getPageByHref(href, { dir: page.file.dirname });
|
||||
if (target) href = target.page.url;
|
||||
|
||||
if (target) {
|
||||
href = target.hash
|
||||
? `${target.page.url}#${target.hash}`
|
||||
: target.page.url;
|
||||
}
|
||||
}
|
||||
|
||||
return <OverrideLink href={href} {...props} />;
|
||||
|
||||
Reference in New Issue
Block a user