fix: show lofter user title (#4750)

This commit is contained in:
hoilc
2020-05-12 14:26:56 +08:00
committed by GitHub
parent 9bccbc2c92
commit ab59be55aa
2 changed files with 21 additions and 4 deletions
+10 -4
View File
@@ -21,11 +21,17 @@ module.exports = async (ctx) => {
supportposttypes: '1,2,3,4,5,6',
},
});
if (!response.data.response || response.data.response.posts.length === 0) {
throw 'Blog Not Found';
}
const data = response.data.response.posts;
const blogNickName = data[0].post.blogInfo.blogNickName;
const selfIntro = data[0].post.blogInfo.selfIntro;
ctx.state.data = {
title: `${ctx.params.username}.lofter.com`,
link: blogdomain,
description: `${ctx.params.username}.lofter.com`,
title: `${blogNickName} - lofter`,
link: `https://${blogdomain}`,
description: selfIntro,
item: data.map((item) => {
let content = item.post.content;
const title = item.post.title || item.post.noticeLinkTitle;
@@ -41,7 +47,7 @@ module.exports = async (ctx) => {
pubDate: new Date(item.post.publishTime).toUTCString(),
link: item.post.blogPageUrl,
guid: item.post.blogPageUrl,
author: item.post.blogInfo.blogNickName,
author: blogNickName,
};
}),
};