Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL trailing slashes dev vs production #332

Closed
gikf opened this issue Sep 14, 2024 · 0 comments · Fixed by #337
Closed

URL trailing slashes dev vs production #332

gikf opened this issue Sep 14, 2024 · 0 comments · Fixed by #337
Labels
type: bug Something isn't working

Comments

@gikf
Copy link
Member

gikf commented Sep 14, 2024

Describe the bug

There's difference how develop and production handles trailing slashes, or lack of in the internal links. In production trailing slashes are added to url when page is opened. That's not a case in dev.

To Reproduce

  1. pnpm run develop
  2. Trailing slashes are not added when opening page, ie. https://contribute.freecodecamp.org/how-to-translate-files stays like that.
  3. Sidebar highlight and Next/Prev links are working correctly.
    vs
  4. pnpm run build && pnpm start or use production.
  5. Trailing slashes are added, ie. https://contribute.freecodecamp.org/how-to-translate-files -> https://contribute.freecodecamp.org/how-to-translate-files/
  6. Sidebar highlight is not working because sidebar links don't use trailing slashes.
  7. Similarly Next/Prev links are messed up with actual url containing trailing slashes.

Expected behavior

Limit the discrepancy between develop and production, to not make it appear working (in dev), when it's actually not working (in production).

Additional context

  • Astro has trailingSlash configuration option, which can be used to always use trailing slashes https://docs.astro.build/en/reference/configuration-reference/#trailingslash. This will however result in develop in 404 error for any link without the trailing slash, so every internal link in sidebar or header would need to have trailing slash added. I had also some troubles with /FAQ/ it was always redirected to /faq.
@gikf gikf added the type: bug Something isn't working label Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
Development

Successfully merging a pull request may close this issue.

1 participant