diff options
-rw-r--r-- | astro.config.mjs | 5 | ||||
-rw-r--r-- | src/components/CanonicalURL.astro | 5 | ||||
-rw-r--r-- | src/layouts/BaseLayout.astro | 4 |
3 files changed, 10 insertions, 4 deletions
diff --git a/astro.config.mjs b/astro.config.mjs index 4840250..d779289 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,4 +1,5 @@ import { defineConfig } from "astro/config"; -// https://astro.build/config -export default defineConfig({}); +export default defineConfig({ + site: "https://popov.link", +}); 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> |