From 338f89deb54f20fb675ef15d8c19b242114ec69c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 24 Jun 2024 15:53:42 -0400 Subject: [PATCH] backport author, and structured data fix to 2.x --- src/controllers/topics.js | 5 +++-- src/views/partials/data/topic.tpl | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/controllers/topics.js b/src/controllers/topics.js index a92570b8c8..ad6681b0b5 100644 --- a/src/controllers/topics.js +++ b/src/controllers/topics.js @@ -105,8 +105,8 @@ topicsController.get = async function getTopic(req, res, next) { topicData.postIndex = postIndex; - await Promise.all([ - buildBreadcrumbs(topicData), + const [author] = await Promise.all([ + user.getUserFields(topicData.uid, ['username', 'userslug']), addOldCategory(topicData, userPrivileges), addTags(topicData, req, res), incrementViewCount(req, tid), @@ -114,6 +114,7 @@ topicsController.get = async function getTopic(req, res, next) { analytics.increment([`pageviews:byCid:${topicData.category.cid}`]), ]); + topicData.author = author; topicData.pagination = pagination.create(currentPage, pageCount, req.query); topicData.pagination.rel.forEach((rel) => { rel.href = `${url}/topic/${topicData.slug}${rel.href}`; diff --git a/src/views/partials/data/topic.tpl b/src/views/partials/data/topic.tpl index ea6fea2a3c..6a39c887f4 100644 --- a/src/views/partials/data/topic.tpl +++ b/src/views/partials/data/topic.tpl @@ -1 +1 @@ -data-index="{posts.index}" data-pid="{posts.pid}" data-uid="{posts.uid}" data-timestamp="{posts.timestamp}" data-username="{posts.user.username}" data-userslug="{posts.user.userslug}" itemscope itemtype="http://schema.org/Comment" \ No newline at end of file +data-index="{posts.index}" data-pid="{posts.pid}" data-uid="{posts.uid}" data-timestamp="{posts.timestamp}" data-username="{posts.user.username}" data-userslug="{posts.user.userslug}" itemprop="comment" itemtype="http://schema.org/Comment" itemscope \ No newline at end of file