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 b2ac604
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/InternalLink/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,17 @@ export default function InternalLink({ href, children }) {
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}`;
}
}
}
}
Expand Down

0 comments on commit b2ac604

Please sign in to comment.