#Trailing slash appears when I run `npm run build`

3 messages · Page 1 of 1 (latest)

versed forge
#

I'm using const canonicalURL = Astro.props.canonicalURL || new URL(Astro.url.pathname, Astro.site); in my baseHead.astro to generate canonical urls. This works fine apart from inserting a trailing slash at the end of the href. For example, https://sitename.com/pagename/ I do not want the end trailing slash to be there. My astro config has trailingSlash: 'never' but I'm not sure this have any influence on the aforementioned

I also just noticed, the trailing slash only appears once I run the build command

versed forge
iron sequoia
#

During build Astro.url includes a trailing slash regardless of the trailingSlash option, which only has effect in the dev server