feat: add hexo next context support (#4724)

This commit is contained in:
hoilc
2020-05-11 18:36:26 +08:00
committed by GitHub
parent f7a1380dac
commit 4960127a9f
+2 -2
View File
@@ -3,7 +3,7 @@ const got = require('@/utils/got');
module.exports = async (ctx) => {
const url = `http://${ctx.params.url}`;
const res = await got.get(`${url}/archives`);
const res = await got.get(`${url}/archives/`);
const $ = cheerio.load(res.data);
const list = $('.post-header');
@@ -18,7 +18,7 @@ module.exports = async (ctx) => {
const storyLink = each.find('.post-title-link').attr('href');
const item = {
title: each.find('[itemprop=name]').text(),
link: encodeURI(`${url}${storyLink}`),
link: encodeURI(new URL(storyLink, url)),
};
const key = item.link;
const value = await ctx.cache.get(key);