diff --git a/docs/bbs.md b/docs/bbs.md index f927bd8f6e..48a4ba6929 100644 --- a/docs/bbs.md +++ b/docs/bbs.md @@ -248,11 +248,11 @@ pageClass: routes ### 子论坛 - + -| 首页 | 你问我答 | 同城活动 | IT 技术 | 金融财经 | 创业创客 | 城市建设 | -| ----- | -------- | -------- | ------- | -------- | -------- | -------- | -| index | qna | lowshine | it | finance | startup | city | +| 首页 | 你问我答 | 同城活动 | IT 技术 | 金融财经 | 创业创客 | 城市建设 | +| ---- | -------- | -------- | ------- | -------- | -------- | -------- | +| | qna | lowshine | it | finance | startup | city | diff --git a/lib/router.js b/lib/router.js index 42b0dcf697..9104088b82 100644 --- a/lib/router.js +++ b/lib/router.js @@ -3145,7 +3145,7 @@ router.get('/gelonghui/subject/:id', require('./routes/gelonghui/subject')); router.get('/gelonghui/keyword/:keyword', require('./routes/gelonghui/keyword')); // 光谷社区 -router.get('/guanggoo/:caty', require('./routes/guanggoo/index')); +router.get('/guanggoo/:category?', require('./routes/guanggoo/index')); // 万维读者 router.get('/creaders/headline', require('./routes/creaders/headline')); diff --git a/lib/routes/guanggoo/index.js b/lib/routes/guanggoo/index.js index faaf9d7034..70cc605bd5 100644 --- a/lib/routes/guanggoo/index.js +++ b/lib/routes/guanggoo/index.js @@ -36,7 +36,9 @@ const config = { }; module.exports = async (ctx) => { - const cfg = config[ctx.params.caty]; + const category = ctx.params.category || 'index'; + + const cfg = config[category]; if (!cfg) { throw Error('Bad category. See docs'); } @@ -54,7 +56,7 @@ module.exports = async (ctx) => { item = $(item); return { title: item.text(), - link: url.resolve(rootUrl, item.attr('href')), + link: url.resolve(rootUrl, item.attr('href').split('#')[0]), }; }) .get();