We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 568266b commit 28f1ed9Copy full SHA for 28f1ed9
packages/gitbook/src/lib/links.ts
@@ -79,9 +79,14 @@ export function baseUrl(): string {
79
80
/**
81
* Create an absolute href in the current content.
82
+ * If it's the root URL, the trailing slash will be removed.
83
*/
84
export function absoluteHref(href: string, withHost: boolean = false): string {
85
const base = withHost ? baseUrl() : basePath();
86
+ if (href === '') {
87
+ // Remove the trailing slash if it's the root URL
88
+ return base.slice(0, -1);
89
+ }
90
return `${base}${href.startsWith('/') ? href.slice(1) : href}`;
91
}
92
0 commit comments