From b5482cee2387149ff397447e546130ba3dea58db Mon Sep 17 00:00:00 2001 From: Ben Holmes Date: Tue, 2 May 2023 13:48:44 -0400 Subject: [PATCH] Fix: remove odd `/1/` check on RSS canonicals (#6970) * fix: remove odd `/1/` check on RSS canonicals * chore: changeset --- .changeset/flat-peas-wave.md | 5 +++++ packages/astro-rss/src/util.ts | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .changeset/flat-peas-wave.md diff --git a/.changeset/flat-peas-wave.md b/.changeset/flat-peas-wave.md new file mode 100644 index 000000000000..11bfdc1aa043 --- /dev/null +++ b/.changeset/flat-peas-wave.md @@ -0,0 +1,5 @@ +--- +"@astrojs/rss": patch +--- + +Fix: remove accidental stripping of trailing `/1/` on canonical URLs diff --git a/packages/astro-rss/src/util.ts b/packages/astro-rss/src/util.ts index 63a8c5568a7c..e40301a4c3d9 100644 --- a/packages/astro-rss/src/util.ts +++ b/packages/astro-rss/src/util.ts @@ -8,7 +8,6 @@ export function createCanonicalURL( base?: string ): URL { let pathname = url.replace(/\/index.html$/, ''); // index.html is not canonical - pathname = pathname.replace(/\/1\/?$/, ''); // neither is a trailing /1/ (impl. detail of collections) if (trailingSlash === false) { // remove the trailing slash pathname = pathname.replace(/(\/+)?$/, '');