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

This commit is contained in:
Barış Soner Uşaklı
2023-08-16 19:59:13 -04:00
parent fcc04ef376
commit e5fc4a5210

View File

@@ -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;
});