From e5fc4a52103baf1852792d177046feb1697fc414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 16 Aug 2023 19:59:13 -0400 Subject: [PATCH] remove /1 from url if it goes to first post of topic --- src/posts/topics.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/posts/topics.js b/src/posts/topics.js index 9c17d33ba9..8e94db3017 100644 --- a/src/posts/topics.js +++ b/src/posts/topics.js @@ -44,7 +44,8 @@ module.exports = function (Posts) { const postIndex = utils.isNumber(indices[index]) ? parseInt(indices[index], 10) + 1 : null; if (slug && postIndex) { - return `/topic/${slug}/${postIndex}`; + const index = postIndex === 1 ? '' : `/${postIndex}`; + return `/topic/${slug}${index}`; } return null; });