fix(route): 光谷社区重复帖子 (#7110)

This commit is contained in:
Ethan Shen
2021-03-11 00:55:16 -05:00
committed by GitHub
parent acb875181a
commit c05427292c
3 changed files with 9 additions and 7 deletions
+4 -4
View File
@@ -248,11 +248,11 @@ pageClass: routes
### 子论坛
<Route author="nczitzk" example="/guanggoo/index" path="/guanggoo/:caty" :paramsDesc="['子论坛']">
<Route author="nczitzk" example="/guanggoo/index" path="/guanggoo/:category?" :paramsDesc="['子论坛,默认为首页']">
| 首页 | 你问我答 | 同城活动 | IT 技术 | 金融财经 | 创业创客 | 城市建设 |
| ----- | -------- | -------- | ------- | -------- | -------- | -------- |
| index | qna | lowshine | it | finance | startup | city |
| 首页 | 你问我答 | 同城活动 | IT 技术 | 金融财经 | 创业创客 | 城市建设 |
| ---- | -------- | -------- | ------- | -------- | -------- | -------- |
| | qna | lowshine | it | finance | startup | city |
</Route>
+1 -1
View File
@@ -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'));
+4 -2
View File
@@ -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 <a href="https://docs.rsshub.app/bbs.html#guang-gu-she-qu-zi-lun-tan">docs</a>');
}
@@ -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();