Added canonical URL

This commit is contained in:
Valentin Popov 2024-09-04 21:23:21 +00:00
parent 7eff3fde57
commit 536956f0f3
Signed by: Valentin Popov
GPG Key ID: AE3CE523DAAA8401
3 changed files with 10 additions and 4 deletions

View File

@ -1,4 +1,5 @@
import { defineConfig } from "astro/config"; import { defineConfig } from "astro/config";
// https://astro.build/config export default defineConfig({
export default defineConfig({}); site: "https://popov.link",
});

View File

@ -0,0 +1,5 @@
---
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
---
<link href={canonicalURL} rel="canonical" />

View File

@ -1,5 +1,5 @@
--- ---
import CanonicalURL from "../components/CanonicalURL.astro";
--- ---
<html> <html>
@ -18,7 +18,7 @@
<link href="#" rel="alternate" title="RSS" type="application/atom+xml" /> <link href="#" rel="alternate" title="RSS" type="application/atom+xml" />
<!-- Canonical URL --> <!-- Canonical URL -->
<link href="#" rel="canonical" /> <CanonicalURL />
</head> </head>
<body> <body>