mirror of
https://github.com/withastro/astro.git
synced 2025-01-06 22:10:10 -05:00
Fix: remove odd /1/
check on RSS canonicals (#6970)
* fix: remove odd `/1/` check on RSS canonicals * chore: changeset
This commit is contained in:
parent
b6797fc858
commit
b5482cee23
2 changed files with 5 additions and 1 deletions
5
.changeset/flat-peas-wave.md
Normal file
5
.changeset/flat-peas-wave.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
"@astrojs/rss": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix: remove accidental stripping of trailing `/1/` on canonical URLs
|
|
@ -8,7 +8,6 @@ export function createCanonicalURL(
|
||||||
base?: string
|
base?: string
|
||||||
): URL {
|
): URL {
|
||||||
let pathname = url.replace(/\/index.html$/, ''); // index.html is not canonical
|
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) {
|
if (trailingSlash === false) {
|
||||||
// remove the trailing slash
|
// remove the trailing slash
|
||||||
pathname = pathname.replace(/(\/+)?$/, '');
|
pathname = pathname.replace(/(\/+)?$/, '');
|
||||||
|
|
Loading…
Reference in a new issue