diff options
| author | nsfisis <nsfisis@gmail.com> | 2023-03-17 02:27:53 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2023-03-17 02:27:53 +0900 |
| commit | ec2ae41b815c4c465a856d800709de6147e5e54f (patch) | |
| tree | ab05d0e2971cdbcfa55e531e6d977cc552c7adf5 /nuldoc-src/templates/tag.ts | |
| parent | 29bcdc6c1bad2240d404de9dca2463e46fdc1e93 (diff) | |
| download | blog.nsfisis.dev-ec2ae41b815c4c465a856d800709de6147e5e54f.tar.gz blog.nsfisis.dev-ec2ae41b815c4c465a856d800709de6147e5e54f.tar.zst blog.nsfisis.dev-ec2ae41b815c4c465a856d800709de6147e5e54f.zip | |
refactor: make Document type class
Diffstat (limited to 'nuldoc-src/templates/tag.ts')
| -rw-r--r-- | nuldoc-src/templates/tag.ts | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/nuldoc-src/templates/tag.ts b/nuldoc-src/templates/tag.ts index a53e59d..8c296d8 100644 --- a/nuldoc-src/templates/tag.ts +++ b/nuldoc-src/templates/tag.ts @@ -22,15 +22,15 @@ export default async function convertTag( ): Promise<Document> { const tagLabel = (config.blog.tagLabels as { [key: string]: string })[tag]; - const doc = { - root: el("__root__", []), - sourceFilePath: `<tag:${tag}>`, - link: `/tags/${tag}/`, - title: tagLabel, - summary: `タグ「${tagLabel}」のついた記事一覧`, - tags: [], - revisions: [], - }; + const doc = new Document( + el("__root__", []), + `<tag:${tag}>`, + `/tags/${tag}/`, + tagLabel, + `タグ「${tagLabel}」のついた記事一覧`, + [], + [], + ); const headChildren = [ metaElement([["charset", "UTF-8"]]), @@ -42,7 +42,7 @@ export default async function convertTag( metaElement([["name", "copyright"], [ "content", `© ${ - posts[posts.length - 1].revisions[0].date.substring(0, 4) + posts[posts.length - 1].getCreatedDate().substring(0, 4) } ${config.blog.author}`, ]]), metaElement([["name", "description"], [ @@ -117,16 +117,16 @@ export default async function convertTag( 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())), ] : []), ), |
