mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-18 04:06:05 +02:00
refactor: organize and categorize functions
This commit is contained in:
parent
f5526f8622
commit
d352b6fb65
13 changed files with 150 additions and 176 deletions
|
@ -1,6 +1,6 @@
|
|||
import type { CollectionEntry } from 'astro:content'
|
||||
import themeConfig from '@/config'
|
||||
import { langPath } from '@/i18n/ui'
|
||||
import { supportedLangs } from '@/i18n/ui'
|
||||
import { getCollection } from 'astro:content'
|
||||
|
||||
// Type definitions
|
||||
|
@ -52,7 +52,7 @@ export async function getPosts(lang?: string) {
|
|||
'posts',
|
||||
({ data }: Post) => {
|
||||
const shouldInclude = import.meta.env.DEV || !data.draft
|
||||
if (!langPath.includes(currentLang)) {
|
||||
if (!supportedLangs.includes(currentLang)) {
|
||||
return shouldInclude && data.lang === ''
|
||||
}
|
||||
return shouldInclude && (data.lang === currentLang || data.lang === '')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue