Skip to content

Commit

Permalink
fix: logic for canonical
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaburgio committed Feb 20, 2024
1 parent 390f392 commit b0f4479
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 2 additions & 3 deletions iconoir.com/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export function Header({ currentVersion }: HeaderProps) {
'https://lucaburgio.com/join?utm_source=iconoir&utm_medium=join-head-banner'
}
target={'_blank'}
rel={'noreferrer'}
>
Access to the latest updates on new icons and ideas. Join the
newsletter.
Expand All @@ -53,7 +52,7 @@ export function Header({ currentVersion }: HeaderProps) {
Donate — Our Mission
</NavigationItem>
<Share $isMobile>
<a href={SHARE_LINK} target={'_blank'} rel={'noreferrer'}>
<a href={SHARE_LINK} target={'_blank'} rel={'noreferrer nofollow'}>
Share with <Heart width={'1em'} height={'1em'} /> on{' '}
<span>X (Twitter)</span>
</a>
Expand All @@ -62,7 +61,7 @@ export function Header({ currentVersion }: HeaderProps) {
</HeaderCenter>
<HeaderRight>
<Share>
<a href={SHARE_LINK} target={'_blank'} rel={'noreferrer'}>
<a href={SHARE_LINK} target={'_blank'} rel={'noreferrer nofollow'}>
Share with <Heart width={'1em'} height={'1em'} /> on{' '}
<span>X (Twitter)</span>
</a>
Expand Down
7 changes: 6 additions & 1 deletion iconoir.com/components/SEO.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Head from 'next/head';
import { useRouter } from 'next/router';

const TITLE_SUFFIX = 'Iconoir | Free Icons';

Expand All @@ -7,13 +8,17 @@ export interface SEOProps {
description?: string;
}
export function SEO({ title, description }: SEOProps) {
const { asPath } = useRouter();
const pageTitle = title ? `${title} | ${TITLE_SUFFIX}` : TITLE_SUFFIX;
const pageDescription = description;

const pathWithoutQuery = asPath.split(/[?#]/)[0];
const canonicalUrl = `https://iconoir.com${pathWithoutQuery !== '/' ? pathWithoutQuery : ''}`;

return (
<Head>
<title>{pageTitle}</title>
<link rel="canonical" href="https://iconoir.com/" />
<link rel="canonical" href={canonicalUrl} />
<meta name="description" content={pageDescription} />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
Expand Down

0 comments on commit b0f4479

Please sign in to comment.