Skip to content

Node.js based forum software built for the modern web

feat: closes #11432, use edited time if its greater

Barış Soner Uşaklıc3854b786e2a
diff --git a/src/controllers/topics.js b/src/controllers/topics.js
index dd536cdf12..3b7c42d958 100644
--- a/src/controllers/topics.js
+++ b/src/controllers/topics.js
@@ -207,6 +207,10 @@ async function addTags(topicData, req, res) {
}
description = description.replace(/\n/g, ' ');
+ const mainPost = postIndex === 0 && postAtIndex ?
+ postAtIndex :
+ await topics.getMainPost(topicData.tid, req.uid);
+
res.locals.metaTags = [
{
name: 'title',
@@ -234,7 +238,7 @@ async function addTags(topicData, req, res) {
},
{
property: 'article:modified_time',
- content: utils.toISOString(topicData.lastposttime),
+ content: utils.toISOString(Math.max(topicData.lastposttime, mainPost && mainPost.edited)),
},
{
property: 'article:section',