nitro icon indicating copy to clipboard operation
nitro copied to clipboard

refactor(netlify): disable `autoSubfolderIndex` for prerendered pages

Open alan-agius4 opened this issue 6 months ago โ€ข 3 comments

๐Ÿ”— Linked issue

โ“ Type of change

  • [ ] ๐Ÿ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • [x] ๐Ÿž Bug fix (a non-breaking change that fixes an issue)
  • [ ] ๐Ÿ‘Œ Enhancement (improving an existing functionality like performance)
  • [ ] โœจ New feature (a non-breaking change that adds functionality)
  • [ ] ๐Ÿงน Chore (updates to the build process or auxiliary tools and libraries)
  • [ ] โš ๏ธ Breaking change (fix or feature that would cause existing functionality to change)

๐Ÿ“š Description

This prevents an unnecessary redirect from /page/ to /page when accessing prerendered content.

๐Ÿ“ Checklist

  • [ ] I have linked an issue or discussion.
  • [ ] I have updated the documentation accordingly.

alan-agius4 avatar Jun 05 '25 12:06 alan-agius4

Adding some links for posterity (I referenced these for my own understanding here!):

  • prerender.autoSubfolderIndex nitro option: https://nitro.build/config#prerender
  • why this avoids a 301 redirect in some cases: https://answers.netlify.com/t/support-guide-how-can-i-alter-trailing-slash-behaviour-in-my-urls-will-enabling-pretty-urls-help/31191#p-86000-im-ssg-lessmy-ssg-uses-static-routing-4

serhalp avatar Jun 25 '25 18:06 serhalp

Thanks for sharing context @serhalp I am totally fine with later backporting this also to v2, perhaps via compat date if you confirm this is certainly a better default and low chance of breaking behavior ๐Ÿ‘๐Ÿผ

pi0 avatar Jun 25 '25 18:06 pi0

/cc @danielroe @TheAlexLichter might have some opinions as it affects current Nuxt users if we backport via compat date.

pi0 avatar Jun 25 '25 18:06 pi0