diff --git a/website/astro.config.mjs b/website/astro.config.mjs index b6617704..c5ca3317 100644 --- a/website/astro.config.mjs +++ b/website/astro.config.mjs @@ -33,8 +33,12 @@ function relativeURLFix() { newHref += `/${path}/${url.href}`; } else if (url.href.startsWith('/')) { // any other relative url starting with / - // NOTE: this does strip off serialized queries and fragments - newHref += url.pathname.endsWith('/') ? url.pathname : url.pathname + '/'; + newHref += url.pathname; + if (url.pathname.indexOf('.') == -1) { + // append trailing slash to resource only if there is no file extension + newHref += url.pathname.endsWith('/') ? '' : '/'; + } + newHref += url.search || ''; newHref += url.hash || ''; } else { // leave this URL alone