chore(frontmatter): dealias created/modified/updated time (#1664)
| | |
| | | |
| | | const socialImage = coalesceAliases(data, ["socialImage", "image", "cover"]) |
| | | |
| | | const created = coalesceAliases(data, ["created", "date"]) |
| | | if (created) data.created = created |
| | | const modified = coalesceAliases(data, [ |
| | | "modified", |
| | | "lastmod", |
| | | "updated", |
| | | "last-modified", |
| | | ]) |
| | | if (modified) data.modified = modified |
| | | const published = coalesceAliases(data, ["published", "publishDate", "date"]) |
| | | if (published) data.published = published |
| | | |
| | | if (socialImage) data.socialImage = socialImage |
| | | |
| | | // fill in frontmatter |
| | |
| | | } & Partial<{ |
| | | tags: string[] |
| | | aliases: string[] |
| | | modified: string |
| | | created: string |
| | | published: string |
| | | description: string |
| | | publish: boolean | string |
| | | draft: boolean | string |
| | |
| | | created ||= st.birthtimeMs |
| | | modified ||= st.mtimeMs |
| | | } else if (source === "frontmatter" && file.data.frontmatter) { |
| | | created ||= file.data.frontmatter.date as MaybeDate |
| | | modified ||= file.data.frontmatter.lastmod as MaybeDate |
| | | modified ||= file.data.frontmatter.updated as MaybeDate |
| | | modified ||= file.data.frontmatter["last-modified"] as MaybeDate |
| | | published ||= file.data.frontmatter.publishDate as MaybeDate |
| | | created ||= file.data.frontmatter.created as MaybeDate |
| | | modified ||= file.data.frontmatter.modified as MaybeDate |
| | | published ||= file.data.frontmatter.published as MaybeDate |
| | | } else if (source === "git") { |
| | | if (!repo) { |
| | | // Get a reference to the main git repo. |