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.
2 parents 11988a5 + c1601cf commit 95a1606Copy full SHA for 95a1606
packages/site-demo/src/components/base/Link.tsx
@@ -9,16 +9,15 @@ interface Props {
9
10
// Format internal link to have the gatsby prefix and trailing slash
11
const formatInternalLink = (path: string) => {
12
- // origin is not important here as it's removed at the end.
13
- const origin = 'http://localhost';
14
- const url = new URL(path, origin);
+ // url relative to current page
+ const url = new URL(path, window.location.href);
15
if (!url.pathname.endsWith('/')) {
16
url.pathname += '/';
17
}
18
if (path.startsWith('/')) {
19
url.pathname = withPrefix(url.pathname);
20
21
- return url.toString().replace(origin, '');
+ return url.pathname;
22
};
23
24
/**
0 commit comments