Skip to content

Commit b231adf

Browse files
committed
Fix canonical URL ending with "/"
1 parent aa2ed0f commit b231adf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/gitbook/src/lib/links.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ export function baseUrl(): string {
8282
*/
8383
export function absoluteHref(href: string, withHost: boolean = false): string {
8484
const base = withHost ? baseUrl() : basePath();
85-
return `${base}${href.startsWith('/') ? href.slice(1) : href}`;
85+
const absoluteHref = `${base}${href.startsWith('/') ? href.slice(1) : href}`;
86+
// Trim trailing slashes
87+
return absoluteHref.replace(/\/$/, '');
8688
}
8789

8890
/**

0 commit comments

Comments
 (0)