We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0e7cf3c commit 1a5ea33Copy full SHA for 1a5ea33
packages/astro/src/default/layouts/Layout.astro
@@ -11,6 +11,7 @@ interface Props {
11
}
12
const { title, meta } = Astro.props;
13
const faviconUrl = readPublicAsset('favicon.svg');
14
+const canonicalUrl = Astro.site ? new URL(Astro.url.pathname, Astro.site).toString() : null;
15
---
16
17
<!doctype html>
@@ -20,6 +21,7 @@ const faviconUrl = readPublicAsset('favicon.svg');
20
21
<title slot="title">{title}</title>
22
23
<Fragment slot="links">
24
+ {canonicalUrl && <link rel="canonical" href={canonicalUrl} />}
25
{faviconUrl ? <link rel="icon" type="image/svg+xml" href={faviconUrl} /> : null}
26
<link rel="preconnect" href="https://fonts.googleapis.com" />
27
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
0 commit comments