feat: do not use path as date
This commit is contained in:
+1
-5
@@ -28,10 +28,6 @@ function readArticleMetadata(path: string): Record<string, string> | null {
|
||||
const metadata: Record<string, string> = {
|
||||
path: path.replaceAll('/index.md', ''),
|
||||
}
|
||||
const dateMatch = path.match(/(\d{4}\/\d{2}\/\d{2})/)
|
||||
if (dateMatch && dateMatch[1]) {
|
||||
metadata['date'] = dateMatch[1].replaceAll('/', '-')
|
||||
}
|
||||
do {
|
||||
subMatch = METADATA_REGEX.exec(match[1])
|
||||
if (subMatch && subMatch[1] && subMatch[2]) {
|
||||
@@ -93,7 +89,7 @@ if (!indexContent) {
|
||||
}
|
||||
|
||||
const metadatas = getFiles('articles')
|
||||
.filter((path) => path.match(/\d{4}\/\d{2}\/\d{2}\/index.md$/))
|
||||
.filter((path) => path.match(/\/index.md$/))
|
||||
.map((path) => readArticleMetadata(path))
|
||||
.filter((metadata) => !!metadata)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user