Skip to content

Commit

Permalink
fix: links
Browse files Browse the repository at this point in the history
  • Loading branch information
sowmya-kota07 committed Nov 10, 2023
1 parent ad2840a commit cb36c30
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/components/InternalLink/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit cb36c30

Please sign in to comment.