Skip to content

Node.js based forum software built for the modern web

remove /1 from url if it goes to first post of topic

Barış Soner Uşaklıe5fc4a52103b
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;
});