denshoproject / encyc-front

front-end interface for the encyclopedia
Other
1 stars 0 forks source link

Do not require trailing slash in urls #105

Closed GeoffFroh closed 2 weeks ago

GeoffFroh commented 3 years ago

Urls for the site should not require a trailing slash.

For example, https://encyclopedia.densho.org/about currently returns a 404.

gjost commented 3 years ago

The Django way of handling this is to set APPEND_SLASH = True. This will cause URLs without a trailing slash to redirect to the same URL with a slash appended. Either URL will work, at the cost of lots of redirects. This should be enabled by default...

gjost commented 3 years ago

Fixed in encyc-front develop branch commit faefa29.

Django has that APPEND_SLASH thing but our requirement that article pages work without the trailing slash kindof broke that. Mitigations included replacing all internal links with Django {% url ... %} tag links (so all links include trailing slashes) and adding some code to the article view so that "static" pages like /about and /history pages without slashes (i.e. links from off-site) still work.