Skip to content

Commit f471f07

Browse files
committed
chore: enable trailing slash via middleware
1 parent 0a484dd commit f471f07

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

app/middleware/trailing-slash.global.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88
* - /docs/getting-started/?query=value → /docs/getting-started?query=value
99
*/
1010
export default defineNuxtRouteMiddleware(to => {
11-
if (!import.meta.dev) return
12-
13-
if (to.path !== '/' && to.path.endsWith('/')) {
11+
if (to.path !== '' && !to.path.endsWith('/')) {
1412
return navigateTo(
1513
{
16-
path: to.path.slice(0, -1),
14+
path: to.path + '/',
1715
query: to.query,
1816
hash: to.hash,
1917
},

nuxt.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ export default defineNuxtConfig({
8686
url: 'https://npmx.dev',
8787
name: 'npmx',
8888
description: 'A fast, modern browser for the npm registry',
89-
trailingSlash: true,
9089
},
9190

9291
router: {

0 commit comments

Comments
 (0)