Skip to content

Commit

Permalink
fix: use url paths
Browse files Browse the repository at this point in the history
  • Loading branch information
ayuhito committed Apr 17, 2024
1 parent 589eb98 commit ca4b565
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion website/app/components/docs/DocsHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,18 @@ interface HitProps {
}

const Hit = ({ hit, children }: HitProps) => {
return <Link to={hit.url}>{children}</Link>;
const url = new URL(hit.url);
// If URL comes from fontsource.org, use the pathname
// else, become an external link
if (url.hostname === 'fontsource.org') {
return <Link to={url.pathname}>{children}</Link>;
}

return (
<a href={hit.url} target="_blank" rel="noopener noreferrer">
{children}
</a>
);
};

const DocSearchModal: LazyExoticComponent<typeof DocSearchModalComponent> =
Expand Down

0 comments on commit ca4b565

Please sign in to comment.