diff --git a/src/components/InternalLink/index.tsx b/src/components/InternalLink/index.tsx index 7d51a4b11e8..86946677cab 100644 --- a/src/components/InternalLink/index.tsx +++ b/src/components/InternalLink/index.tsx @@ -21,21 +21,29 @@ export default function InternalLink({ href, children }) { } else if (href.startsWith('/start')) { filterKind = 'integration'; } - + console.log('before', href); if (filterKind != '') { if (!href.includes(`/q/${filterKind}/`)) { if (filterKind in filterKeys) { const filterKey = filterKeys[filterKind]; if (href.includes('#')) { const hrefParts = href.split('#'); - href = `${hrefParts[0]}q/${filterKind}/${filterKey}#${hrefParts[1]}`; + if (hrefParts[0].endsWith('/')) { + href = `${hrefParts[0]}q/${filterKind}/${filterKey}#${hrefParts[1]}`; + } else { + href = `${hrefParts[0]}/q/${filterKind}/${filterKey}/${hrefParts[1]}`; + } } else { - href += `/q/${filterKind}/${filterKey}`; + if (href.endsWith('/')) { + href += `q/${filterKind}/${filterKey}`; + } else { + href += `/q/${filterKind}/${filterKey}`; + } } } } } - + console.log('before', href); if (href[0] === '#') { const prevPath = router.asPath.split('#')[0]; href = prevPath + href;