Add canonical URL to blog example (#5651)

This commit is contained in:
Shivam 2022-12-21 23:47:40 +05:30 committed by GitHub
parent 0b50987584
commit 46757a6ce3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,6 +9,8 @@ export interface Props {
image?: string; image?: string;
} }
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
const { title, description, image = '/placeholder-social.jpg' } = Astro.props; const { title, description, image = '/placeholder-social.jpg' } = Astro.props;
--- ---
@ -18,6 +20,9 @@ const { title, description, image = '/placeholder-social.jpg' } = Astro.props;
<link rel="icon" type="image/svg+xml" href="/favicon.svg" /> <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="generator" content={Astro.generator} /> <meta name="generator" content={Astro.generator} />
<!-- Canonical URL -->
<link rel="canonical" href={canonicalURL} />
<!-- Primary Meta Tags --> <!-- Primary Meta Tags -->
<title>{title}</title> <title>{title}</title>
<meta name="title" content={title} /> <meta name="title" content={title} />