Skip to content

Commit b67abc1

Browse files
committed
chore: make canonical generation more robust
1 parent 9701fb5 commit b67abc1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Diff for: src/server/createCanonicalPath.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
import { FULL_DOMAIN } from '@/utils/constants'
1+
import { DOMAIN, BASE_PATH } from '@/utils/constants'
22

33
export const createCanonicalPath = (path: string[]) => {
4-
const canonicalPath = `${FULL_DOMAIN}/${path.join('/')}`
5-
return canonicalPath
4+
const urlPath = [BASE_PATH, ...path].join('/')
5+
const canonicalUrl = new URL(urlPath, DOMAIN)
6+
const href = canonicalUrl.href
7+
8+
return href
69
}

0 commit comments

Comments
 (0)