forked from chengxuanying/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(core): pubdate, npm ci with templates (DIYgod#7501)
- Loading branch information
1 parent
10f5bb7
commit 9a3ae8a
Showing
14 changed files
with
20,573 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ node_modules | |
npm-debug.log | ||
error.log | ||
combined.log | ||
package-lock.json | ||
.vscode | ||
.idea | ||
.DS_Store | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module.exports = [ | ||
{ | ||
text: 'Guide', | ||
link: '/en/', | ||
}, | ||
{ | ||
text: 'Join Us', | ||
ariaLabel: 'Join Us', | ||
items: [ | ||
{ | ||
text: 'Getting Started', | ||
link: '/joinus/quick-start', | ||
}, | ||
{ | ||
text: 'More details', | ||
items: [ | ||
{ | ||
text: 'Date Handling', | ||
link: '/joinus/pub-date', | ||
}, | ||
{ | ||
text: 'Use Cache', | ||
link: '/joinus/use-cache', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
{ | ||
text: 'Deploy', | ||
link: '/en/install/', | ||
}, | ||
{ | ||
text: 'Support RSSHub', | ||
link: '/en/support/', | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module.exports = [ | ||
{ | ||
text: '指南', | ||
link: '/', | ||
}, | ||
{ | ||
text: '参与我们', | ||
ariaLabel: '参与我们', | ||
items: [ | ||
{ | ||
text: '快速开始', | ||
link: '/joinus/quick-start', | ||
}, | ||
{ | ||
text: '详细规范', | ||
items: [ | ||
{ | ||
text: '日期处理', | ||
link: '/joinus/pub-date', | ||
}, | ||
{ | ||
text: '使用缓存', | ||
link: '/joinus/use-cache', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
{ | ||
text: '部署', | ||
link: '/install/', | ||
}, | ||
{ | ||
text: '支持 RSSHub', | ||
link: '/support/', | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# 日期处理 | ||
|
||
在抓取网页的时候,通常情况下网页会提供日期。这篇教程用于说明插件应当如何正确的处理相关情况 | ||
|
||
## 没有日期 | ||
|
||
在源没有提供日期的时候,**请勿添加日期**。`pubDate`选项应当被留空。 | ||
|
||
## 规范 | ||
|
||
`pubDate`接受一个[Date Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)。或者是可以被正确解析的字符串。这里**并不推荐直接返回字符串的方式**,因为其行为可能在不同环境下不一致,[Date.parse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse) | ||
|
||
## 使用工具类 | ||
|
||
目前,我们推荐使用[dayjs](https://github.com/iamkun/dayjs)进行日期的处理和时区调整。相关工具类有两个: | ||
|
||
### Parse Date | ||
|
||
这个是一个工具类用于使用[dayjs](https://github.com/iamkun/dayjs)。大部分情况下,应当可以直接使用他获取到正确的`Date Object` | ||
|
||
具体解析参数请参考dayjs github说明 | ||
|
||
```javascript | ||
const parseDate = require('@/utils/parse-date'); | ||
|
||
const pubDate = parseDate('2020/12/30', 'YYYY/MM/DD') | ||
``` | ||
|
||
|
||
### Timezone | ||
|
||
部分网站并不会依据访问者来源进行时区转换,此时获取到的时间是网站本地时间,不一定适合所有RSS订阅者。此时,应当手动指定获取的时间时区: | ||
|
||
::: warning 注意 | ||
此时,时间将会被转换到服务器时间,方便后续中间件处理。这个是正常流程! | ||
::: | ||
|
||
```javascript | ||
const timezone = require('@/utils/timezone'); | ||
|
||
const pubDate = timezone(new Date(), +8) | ||
``` |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# 使用缓存 | ||
|
||
部分RSS在生成时需要访问数个页面,这些页面同时并不是很可能经常变化。出于减轻对方服务器压力和节约不必要流量/算力的考虑,这种情况下应当使用缓存。下面是关于缓存工具类的使用场景和具体介绍 | ||
|
||
<!-- @TODO 在cache类重构后完善 --> |
Oops, something went wrong.