From e6d7e55fbc0d4712adf26950e03235481cfbd3b4 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 24 Feb 2023 14:23:42 -0500 Subject: [PATCH] fix: missing postAtIndex handling --- src/controllers/topics.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/controllers/topics.js b/src/controllers/topics.js index 6033da5958..dd536cdf12 100644 --- a/src/controllers/topics.js +++ b/src/controllers/topics.js @@ -249,10 +249,6 @@ async function addTags(topicData, req, res) { rel: 'canonical', href: `${url}/topic/${topicData.slug}`, }, - { - rel: 'author', - href: `${url}/user/${postAtIndex.user.userslug}`, - }, ]; if (!topicData['feeds:disableRSS']) { @@ -269,6 +265,13 @@ async function addTags(topicData, req, res) { href: `${url}/category/${topicData.category.slug}`, }); } + + if (postAtIndex) { + res.locals.linkTags.push({ + rel: 'author', + href: `${url}/user/${postAtIndex.user.userslug}`, + }); + } } async function addOGImageTags(res, topicData, postAtIndex) {