From 469e17b26242829011b75fa49205c540dbeffad6 Mon Sep 17 00:00:00 2001 From: DerekCao Date: Tue, 8 May 2018 23:18:11 +0800 Subject: [PATCH] =?UTF-8?q?add=20"link"=20type=20for=20"=E7=9F=A5=E4=B9=8E?= =?UTF-8?q?=E6=83=B3=E6=B3=95"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/zhihu/activities.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/routes/zhihu/activities.js b/routes/zhihu/activities.js index e1f9e0867..cb22c561c 100644 --- a/routes/zhihu/activities.js +++ b/routes/zhihu/activities.js @@ -49,14 +49,17 @@ module.exports = async (ctx) => { title = detail.excerptTitle.length > 17 ? detail.excerptTitle.slice(0, 17) + '...' : detail.excerptTitle; const images = []; let text = ""; + let link = ""; detail.content.forEach(contentItem => { if (contentItem.type === "text") { - text = contentItem.ownText; + text = `

${contentItem.ownText}

`; } else if (contentItem.type === "image") { images.push(`

`); + } else if (contentItem.type === "link") { + link = `

${contentItem.title}

` } }) - description = `

${text}

${images.join('')}`; + description = `${text}${link}${images.join('')}`; url = `https://www.zhihu.com/pin/${detail.id}`; break; case 'question':