aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2024-09-05 00:23:21 +0300
committerValentin Popov <valentin@popov.link>2024-09-05 00:23:21 +0300
commit536956f0f320d1cf4be0938d7836a1dee64b345a (patch)
tree5a5b47fc388c0a3109145c28fc87adf0f4a53574 /src
parent7eff3fde5720eb23449e2f8c8ea0b8218efe4dde (diff)
downloadpopov.link-536956f0f320d1cf4be0938d7836a1dee64b345a.tar.xz
popov.link-536956f0f320d1cf4be0938d7836a1dee64b345a.zip
Added canonical URL
Diffstat (limited to 'src')
-rw-r--r--src/components/CanonicalURL.astro5
-rw-r--r--src/layouts/BaseLayout.astro4
2 files changed, 7 insertions, 2 deletions
diff --git a/src/components/CanonicalURL.astro b/src/components/CanonicalURL.astro
new file mode 100644
index 0000000..0081f71
--- /dev/null
+++ b/src/components/CanonicalURL.astro
@@ -0,0 +1,5 @@
+---
+const canonicalURL = new URL(Astro.url.pathname, Astro.site);
+---
+
+<link href={canonicalURL} rel="canonical" />
diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro
index c100dad..2def353 100644
--- a/src/layouts/BaseLayout.astro
+++ b/src/layouts/BaseLayout.astro
@@ -1,5 +1,5 @@
---
-
+import CanonicalURL from "../components/CanonicalURL.astro";
---
<html>
@@ -18,7 +18,7 @@
<link href="#" rel="alternate" title="RSS" type="application/atom+xml" />
<!-- Canonical URL -->
- <link href="#" rel="canonical" />
+ <CanonicalURL />
</head>
<body>