diff --git a/CHANGELOG.md b/CHANGELOG.md index d473977..ffb836a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # @triyanox/next-routes +## 0.1.5 + +### Patch Changes + +- Remove slashes at the end of the path + ## 0.1.4 ### Patch Changes diff --git a/package.json b/package.json index 7aed9fc..0b8129e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@triyanox/next-routes", "description": "You will never have broken links in your Next.js app again", - "version": "0.1.4", + "version": "0.1.5", "publishConfig": { "access": "public" }, diff --git a/src/utils.ts b/src/utils.ts index c9192e5..27c78ec 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -84,7 +84,11 @@ const generateRoutes = async (appDir: string): Promise => { ...route, path: cleanPath(route.path, appDir), })) - .filter((route) => route.path !== ''); + .filter((route) => route.path !== '') + .map((route) => ({ + ...route, + path: route.path === '/' ? route.path : route.path.replace(/\/$/, ''), + })); routes_generated.push({ path: '/',