From 31592426a8a777dc801f9a842680214b60259b46 Mon Sep 17 00:00:00 2001 From: ycjcl868 <45808948@qq.com> Date: Thu, 1 Aug 2019 01:13:23 +0800 Subject: [PATCH] fix: seo --- site/theme/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/site/theme/index.js b/site/theme/index.js index eb2ae17927..9a30e09689 100644 --- a/site/theme/index.js +++ b/site/theme/index.js @@ -54,7 +54,8 @@ module.exports = { selector: ($, pathname) => { let description = ''; if (pathname !== '/') { - description = ($('section.markdown p').text() || '').slice(0, 50); + const desc = ($('section.markdown p').text() || ''); + description = desc.length > 50 ? `${desc.slice(0, 50)}...` : desc; } console.log('description', description); return {