Enforce trailing slash through js

I need to enforce a trailing slash on all my website’s pages, otherwise the content looks messed up (the building chain is a bit complex; there are multiple repos that provide content to different sub domains the same main domain). Compare:

https://www.phenopype.org/gallery/ vs https://www.phenopype.org/gallery

I thought that the first function in this js file would take care of it (it does when I test my site locally), but after deployment it doesn’t work: https://www.phenopype.org/gallery/_static/js/custom.js?v=20423946

Note that I cannot use “prettify urls” because of the redirect that merges my subdomains: https://github.com/phenopype/phenopype-lander/blob/main/netlify.toml

Any thoughts or comments? Thanks!

Pretty URLs won’t have any effect on those redirects and should be the solution to your problem.