Add correct rel values to anchored links

This commit is contained in:
Luke Vella 2022-04-20 09:03:13 +01:00
parent f30505e1f8
commit f206d31083

View file

@ -10,9 +10,10 @@ export const truncateLink = (href: string, text: string, key: number) => {
if (beginningOfPath !== -1) { if (beginningOfPath !== -1) {
finalText = textWithoutProtocol.substring(0, beginningOfPath + 15); finalText = textWithoutProtocol.substring(0, beginningOfPath + 15);
} }
if (finalText.length === textWithoutProtocol.length) { if (finalText.length === textWithoutProtocol.length) {
return ( return (
<a key={key} href={href}> <a key={key} href={href} rel="nofollow noreferrer">
{finalText} {finalText}
</a> </a>
); );
@ -25,7 +26,9 @@ export const truncateLink = (href: string, text: string, key: number) => {
<div className="max-w-md break-all font-mono text-xs">{href}</div> <div className="max-w-md break-all font-mono text-xs">{href}</div>
} }
> >
<a href={href}>{finalText}</a> <a href={href} rel="nofollow noreferrer">
{finalText}
</a>
</Tooltip> </Tooltip>
); );
} }