diff options
Diffstat (limited to 'nuldoc-src/templates/post_list.ts')
| -rw-r--r-- | nuldoc-src/templates/post_list.ts | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/nuldoc-src/templates/post_list.ts b/nuldoc-src/templates/post_list.ts index f4a541b..cdd2253 100644 --- a/nuldoc-src/templates/post_list.ts +++ b/nuldoc-src/templates/post_list.ts @@ -19,15 +19,15 @@ export default async function convertPostList( posts: Document[], config: Config, ): Promise<Document> { - const doc = { - root: el("__root__", []), - sourceFilePath: "<postList>", - link: "/posts/", - title: "投稿一覧", - summary: "投稿した記事の一覧", - tags: [], - revisions: [], - }; + const doc = new Document( + el("__root__", []), + "<postList>", + "/posts/", + "投稿一覧", + "投稿した記事の一覧", + [], + [], + ); const head = el( "head", @@ -95,8 +95,8 @@ export default async function convertPostList( ), ), ...Array.from(posts).sort((a, b) => { - const ta = a.revisions[0].date; - const tb = b.revisions[0].date; + const ta = a.getCreatedDate(); + const tb = b.getCreatedDate(); if (ta > tb) return -1; if (ta < tb) return 1; return 0; @@ -123,16 +123,16 @@ export default async function convertPostList( text("Posted on"), el( "time", - [["datetime", post.revisions[0].date]], - text(post.revisions[0].date), + [["datetime", post.getCreatedDate()]], + text(post.getCreatedDate()), ), ...(post.revisions.length > 1 ? [ text(", updated on "), el("time", [[ "datetime", - post.revisions[post.revisions.length - 1].date, - ]], text(post.revisions[post.revisions.length - 1].date)), + post.getUpdatedDate(), + ]], text(post.getUpdatedDate())), ] : []), ), |
