mirror of
https://github.com/coollabsio/coolify-docs.git
synced 2026-06-19 07:35:55 +00:00
fix(docs): preserve hash anchor links
This commit is contained in:
+16
-2
@@ -1,4 +1,4 @@
|
||||
import { createRootRoute, HeadContent, Outlet, Scripts } from '@tanstack/react-router';
|
||||
import { createRootRoute, HeadContent, Link, Outlet, Scripts } from '@tanstack/react-router';
|
||||
import { RootProvider } from 'fumadocs-ui/provider/tanstack';
|
||||
import * as React from 'react';
|
||||
import SearchDialog from '@/components/search';
|
||||
@@ -116,7 +116,7 @@ function RootComponent() {
|
||||
) : null}
|
||||
</head>
|
||||
<body className="flex min-h-screen flex-col">
|
||||
<RootProvider search={{ SearchDialog }}>
|
||||
<RootProvider components={{ Link: DocsLink }} search={{ SearchDialog }}>
|
||||
<Outlet />
|
||||
</RootProvider>
|
||||
<Scripts />
|
||||
@@ -124,3 +124,17 @@ function RootComponent() {
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
||||
function DocsLink({
|
||||
href = '#',
|
||||
prefetch = true,
|
||||
...props
|
||||
}: React.AnchorHTMLAttributes<HTMLAnchorElement> & {
|
||||
prefetch?: boolean;
|
||||
}) {
|
||||
if (href.startsWith('#')) {
|
||||
return <a href={href} {...props} />;
|
||||
}
|
||||
|
||||
return <Link to={href} preload={prefetch ? 'intent' : false} {...props} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user