From 66cb4f9a06240238c44dfb7d03f357f366e4f386 Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Sun, 8 Jan 2023 06:25:19 +0400 Subject: [PATCH] Fix canonicals --- src/layouts/BaseLayout.astro | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index 5b949b964..b239ff056 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -27,7 +27,11 @@ const { sponsor, } = Astro.props; -const currentPageAbsoluteUrl = `https://roadmap.sh${permalink}`; +// Remove trailing slashes to consider the page as canonical +const currentPageAbsoluteUrl = `https://roadmap.sh${permalink.replace( + /\/$/, + '' +)}`; --- @@ -59,7 +63,7 @@ const currentPageAbsoluteUrl = `https://roadmap.sh${permalink}`; - + {currentPageAbsoluteUrl !== 'https://roadmap.sh' && }