vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
13.29k stars 2.15k forks source link

VitePress not respecting Vercel Clean URLs, .html still appended to navigation links #4187

Closed admin8756 closed 2 months ago

admin8756 commented 2 months ago

Describe the bug

I have configured Vercel's Clean URL feature, but it doesn't seem to work with VitePress. Despite the Clean URL setting, my navigation links still include .html extensions, which causes unnecessary redirects. Below is my nav configuration:

nav: [
  { text: 'Home', link: '/' },
  { text: 'Radio', link: '/radio' },
  { text: 'Nostalgia', link: '/nostalgia' },
  { text: 'Archives', link: '/archives' },
  { text: 'Tags', link: '/tags' },
  { text: 'About', link: '/about' }
]

Even with this configuration, VitePress still appends .html to the links in the generated pages. Is this an issue with my setup, or a bug in VitePress?

Reproduction

  1. Deploy a VitePress site on Vercel.
  2. Enable Vercel's Clean URL feature.
  3. Configure the VitePress nav with standard links (as shown above).
  4. Observe the .html still present in the navigation links and the redirects happening when accessing URLs without .html.

Expected behavior

When using Vercel's Clean URL feature, the .html extension should be omitted from both the navigation links and the actual URLs served by VitePress, without triggering redirects.

System Info

Vercel: Clean URLs enabled
VitePress: 1.3.4
Browser: Google Chrome 127.0.6533.100
Operating System: Windows

Additional context

No response

Validations