From 4960127a9fe6926c3040662feb2f0ad67f0ea1cb Mon Sep 17 00:00:00 2001 From: hoilc Date: Mon, 11 May 2020 18:36:26 +0800 Subject: [PATCH] feat: add hexo next context support (#4724) --- lib/routes/hexo/next.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/routes/hexo/next.js b/lib/routes/hexo/next.js index 8bb35063d..4dfb7cc76 100644 --- a/lib/routes/hexo/next.js +++ b/lib/routes/hexo/next.js @@ -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);