diff options
author | 2022-12-21 23:47:40 +0530 | |
---|---|---|
committer | 2022-12-21 19:17:40 +0100 | |
commit | 46757a6ce38a7073773af0cb77f687db571632f0 (patch) | |
tree | 592df845847745f6b7a242d63561cfd5a84e1921 /examples/blog/src | |
parent | 0b50987584120e0c0e549f9ff838dc8879dbfa30 (diff) | |
download | astro-46757a6ce38a7073773af0cb77f687db571632f0.tar.gz astro-46757a6ce38a7073773af0cb77f687db571632f0.tar.zst astro-46757a6ce38a7073773af0cb77f687db571632f0.zip |
Add canonical URL to blog example (#5651)
Diffstat (limited to 'examples/blog/src')
-rw-r--r-- | examples/blog/src/components/BaseHead.astro | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/examples/blog/src/components/BaseHead.astro b/examples/blog/src/components/BaseHead.astro index ce60a7e77..371f6bd85 100644 --- a/examples/blog/src/components/BaseHead.astro +++ b/examples/blog/src/components/BaseHead.astro @@ -9,6 +9,8 @@ export interface Props { image?: string; } +const canonicalURL = new URL(Astro.url.pathname, Astro.site); + 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" /> <meta name="generator" content={Astro.generator} /> +<!-- Canonical URL --> +<link rel="canonical" href={canonicalURL} /> + <!-- Primary Meta Tags --> <title>{title}</title> <meta name="title" content={title} /> |