diff options
Diffstat (limited to 'nuldoc-src/pages/post.ts')
| -rw-r--r-- | nuldoc-src/pages/post.ts | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/nuldoc-src/pages/post.ts b/nuldoc-src/pages/post.ts index 0bc313b..d870e99 100644 --- a/nuldoc-src/pages/post.ts +++ b/nuldoc-src/pages/post.ts @@ -6,7 +6,7 @@ import { Config } from "../config.ts"; import { el, Element, text } from "../dom.ts"; import { Document } from "../docbook/document.ts"; import { Page } from "../page.ts"; -import { Revision } from "../revision.ts"; +import { Date, dateToString, Revision } from "../revision.ts"; export interface PostPage extends Page { title: string; @@ -15,11 +15,11 @@ export interface PostPage extends Page { revisions: Revision[]; } -export function getPostCreatedDate(page: { revisions: Revision[] }): string { +export function getPostCreatedDate(page: { revisions: Revision[] }): Date { return page.revisions[0].date; } -export function getPostUpdatedDate(page: { revisions: Revision[] }): string { +export function getPostUpdatedDate(page: { revisions: Revision[] }): Date { return page.revisions[page.revisions.length - 1].date; } @@ -87,8 +87,8 @@ export async function generatePostPage( [["class", "revision"]], el( "time", - [["datetime", rev.date]], - text(rev.date), + [["datetime", dateToString(rev.date)]], + text(dateToString(rev.date)), ), text(`: ${rev.remark}`), ) @@ -113,9 +113,7 @@ export async function generatePostPage( const html = await pageLayout( { - metaCopyrightYear: parseInt( - getPostCreatedDate(doc).substring(0, 4), - ), + metaCopyrightYear: getPostCreatedDate(doc).year, metaDescription: doc.summary, metaKeywords: doc.tags.map((slug) => (config.blog.tagLabels as { [key: string]: string })[slug] |
