Skip to content

Commit

Permalink
fix: page.date and page.updated should take higher priority
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Nov 5, 2019
1 parent 0d0d06e commit 80a2a90
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/saber/src/Pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,13 @@ export class Pages extends Map<string, Page> {
// And transformers can update the `page`
// So we set them after applying the transformer

// Fallback to `page.date` (Hexo compatibility)
page.createdAt = page.createdAt || page.date

// Fallback to `page.updated` (Hexo compatibility)
page.updatedAt = page.updatedAt || page.updated
// Hexo compatibility
if (page.date) {
page.createdAt = page.date
}
if (page.updated) {
page.updatedAt = page.updated
}

// Ensure date format
if (typeof page.createdAt === 'string') {
Expand Down

0 comments on commit 80a2a90

Please sign in to comment.