mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-17 12:01:33 +02:00
refactor: optimize rss generation logic
This commit is contained in:
parent
f34b0cb46b
commit
0888b59c5f
7 changed files with 128 additions and 155 deletions
|
@ -5,7 +5,7 @@ import sanitizeHtml from 'sanitize-html'
|
|||
|
||||
const parser = new MarkdownIt()
|
||||
|
||||
type ExcerptScene = 'list' | 'meta' | 'og'
|
||||
type ExcerptScene = 'list' | 'meta' | 'og' | 'rss'
|
||||
|
||||
// Excerpt length in different scenarios
|
||||
const EXCERPT_LENGTHS: Record<ExcerptScene, {
|
||||
|
@ -24,6 +24,10 @@ const EXCERPT_LENGTHS: Record<ExcerptScene, {
|
|||
cjk: 75,
|
||||
other: 150,
|
||||
},
|
||||
rss: {
|
||||
cjk: 120,
|
||||
other: 240,
|
||||
},
|
||||
}
|
||||
|
||||
const isCJKLang = (lang: string) => ['zh', 'zh-tw', 'ja'].includes(lang)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue