aboutsummaryrefslogtreecommitdiffhomepage
path: root/nuldoc-src/pages
diff options
context:
space:
mode:
Diffstat (limited to 'nuldoc-src/pages')
-rw-r--r--nuldoc-src/pages/about.ts3
-rw-r--r--nuldoc-src/pages/post.ts14
-rw-r--r--nuldoc-src/pages/post_list.ts5
-rw-r--r--nuldoc-src/pages/slide.ts10
-rw-r--r--nuldoc-src/pages/slide_list.ts5
-rw-r--r--nuldoc-src/pages/tag.ts4
6 files changed, 19 insertions, 22 deletions
diff --git a/nuldoc-src/pages/about.ts b/nuldoc-src/pages/about.ts
index adf4d73..459b88c 100644
--- a/nuldoc-src/pages/about.ts
+++ b/nuldoc-src/pages/about.ts
@@ -4,6 +4,7 @@ import { pageLayout } from "../components/page_layout.ts";
import { Config } from "../config.ts";
import { el, text } from "../dom.ts";
import { Page } from "../page.ts";
+import { dateToString } from "../revision.ts";
import { getPostCreatedDate } from "./post.ts";
import { SlidePage } from "./slide.ts";
@@ -125,7 +126,7 @@ export async function generateAboutPage(
[["href", slide.href]],
text(
`${
- getPostCreatedDate(slide)
+ dateToString(getPostCreatedDate(slide))
}: ${slide.event} (${slide.talkType})`,
),
),
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]
diff --git a/nuldoc-src/pages/post_list.ts b/nuldoc-src/pages/post_list.ts
index e8f27ee..498b3ef 100644
--- a/nuldoc-src/pages/post_list.ts
+++ b/nuldoc-src/pages/post_list.ts
@@ -5,6 +5,7 @@ import { postPageEntry } from "../components/post_page_entry.ts";
import { Config } from "../config.ts";
import { el, text } from "../dom.ts";
import { Page } from "../page.ts";
+import { dateToString } from "../revision.ts";
import { getPostCreatedDate, PostPage } from "./post.ts";
export type PostListPage = Page;
@@ -32,8 +33,8 @@ export async function generatePostListPage(
),
),
...Array.from(posts).sort((a, b) => {
- const ta = getPostCreatedDate(a);
- const tb = getPostCreatedDate(b);
+ const ta = dateToString(getPostCreatedDate(a));
+ const tb = dateToString(getPostCreatedDate(b));
if (ta > tb) return -1;
if (ta < tb) return 1;
return 0;
diff --git a/nuldoc-src/pages/slide.ts b/nuldoc-src/pages/slide.ts
index 2b7e202..f2955af 100644
--- a/nuldoc-src/pages/slide.ts
+++ b/nuldoc-src/pages/slide.ts
@@ -5,7 +5,7 @@ import { pageLayout } from "../components/page_layout.ts";
import { Config } from "../config.ts";
import { el, text } from "../dom.ts";
import { Page } from "../page.ts";
-import { Revision } from "../revision.ts";
+import { dateToString, Revision } from "../revision.ts";
import { Slide } from "../slide/slide.ts";
import { getPostCreatedDate } from "./post.ts";
@@ -82,8 +82,8 @@ export async function generateSlidePage(
[["class", "revision"]],
el(
"time",
- [["datetime", rev.date]],
- text(rev.date),
+ [["datetime", dateToString(rev.date)]],
+ text(dateToString(rev.date)),
),
text(`: ${rev.remark}`),
)
@@ -119,9 +119,7 @@ export async function generateSlidePage(
const html = await pageLayout(
{
- metaCopyrightYear: parseInt(
- getPostCreatedDate(slide).substring(0, 4),
- ),
+ metaCopyrightYear: getPostCreatedDate(slide).year,
metaDescription: slide.title,
metaKeywords: slide.tags.map((slug) =>
(config.blog.tagLabels as { [key: string]: string })[slug]
diff --git a/nuldoc-src/pages/slide_list.ts b/nuldoc-src/pages/slide_list.ts
index 18bea1f..5031436 100644
--- a/nuldoc-src/pages/slide_list.ts
+++ b/nuldoc-src/pages/slide_list.ts
@@ -5,6 +5,7 @@ import { slidePageEntry } from "../components/slide_page_entry.ts";
import { Config } from "../config.ts";
import { el, text } from "../dom.ts";
import { Page } from "../page.ts";
+import { dateToString } from "../revision.ts";
import { getPostCreatedDate } from "./post.ts";
import { SlidePage } from "./slide.ts";
@@ -33,8 +34,8 @@ export async function generateSlideListPage(
),
),
...Array.from(slides).sort((a, b) => {
- const ta = getPostCreatedDate(a);
- const tb = getPostCreatedDate(b);
+ const ta = dateToString(getPostCreatedDate(a));
+ const tb = dateToString(getPostCreatedDate(b));
if (ta > tb) return -1;
if (ta < tb) return 1;
return 0;
diff --git a/nuldoc-src/pages/tag.ts b/nuldoc-src/pages/tag.ts
index fbab8b1..cb60d21 100644
--- a/nuldoc-src/pages/tag.ts
+++ b/nuldoc-src/pages/tag.ts
@@ -40,9 +40,7 @@ export async function generateTagPage(
const html = await pageLayout(
{
- metaCopyrightYear: parseInt(
- getPostCreatedDate(pages[pages.length - 1]).substring(0, 4),
- ),
+ metaCopyrightYear: getPostCreatedDate(pages[pages.length - 1]).year,
metaDescription: `タグ「${tagLabel}」のついた記事またはスライドの一覧`,
metaKeywords: [tagLabel],
metaTitle: `${pageTitle} | ${config.blog.siteName}`,