From 16182acfcc1fad2885b9c1a96fe74d8ce56a50e0 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 12 Jan 2025 21:59:55 +0900 Subject: refactor(blog/nuldoc): separate pages/* to pages/* and generators/* --- vhosts/blog/nuldoc-src/pages/AboutPage.tsx | 94 +++++++++++++++++++ vhosts/blog/nuldoc-src/pages/HomePage.tsx | 53 +++++++++++ vhosts/blog/nuldoc-src/pages/NotFoundPage.tsx | 27 ++++++ vhosts/blog/nuldoc-src/pages/PostListPage.tsx | 41 +++++++++ vhosts/blog/nuldoc-src/pages/PostPage.tsx | 74 +++++++++++++++ vhosts/blog/nuldoc-src/pages/SlideListPage.tsx | 42 +++++++++ vhosts/blog/nuldoc-src/pages/SlidePage.tsx | 70 ++++++++++++++ vhosts/blog/nuldoc-src/pages/TagListPage.tsx | 57 ++++++++++++ vhosts/blog/nuldoc-src/pages/TagPage.tsx | 43 +++++++++ vhosts/blog/nuldoc-src/pages/about.tsx | 105 --------------------- vhosts/blog/nuldoc-src/pages/home.tsx | 64 ------------- vhosts/blog/nuldoc-src/pages/not_found.tsx | 38 -------- vhosts/blog/nuldoc-src/pages/post.tsx | 123 ------------------------- vhosts/blog/nuldoc-src/pages/post_list.tsx | 52 ----------- vhosts/blog/nuldoc-src/pages/slide.tsx | 109 ---------------------- vhosts/blog/nuldoc-src/pages/slide_list.tsx | 53 ----------- vhosts/blog/nuldoc-src/pages/tag.tsx | 63 ------------- vhosts/blog/nuldoc-src/pages/tag_list.tsx | 68 -------------- vhosts/blog/nuldoc-src/pages/tagged_page.ts | 4 - 19 files changed, 501 insertions(+), 679 deletions(-) create mode 100644 vhosts/blog/nuldoc-src/pages/AboutPage.tsx create mode 100644 vhosts/blog/nuldoc-src/pages/HomePage.tsx create mode 100644 vhosts/blog/nuldoc-src/pages/NotFoundPage.tsx create mode 100644 vhosts/blog/nuldoc-src/pages/PostListPage.tsx create mode 100644 vhosts/blog/nuldoc-src/pages/PostPage.tsx create mode 100644 vhosts/blog/nuldoc-src/pages/SlideListPage.tsx create mode 100644 vhosts/blog/nuldoc-src/pages/SlidePage.tsx create mode 100644 vhosts/blog/nuldoc-src/pages/TagListPage.tsx create mode 100644 vhosts/blog/nuldoc-src/pages/TagPage.tsx delete mode 100644 vhosts/blog/nuldoc-src/pages/about.tsx delete mode 100644 vhosts/blog/nuldoc-src/pages/home.tsx delete mode 100644 vhosts/blog/nuldoc-src/pages/not_found.tsx delete mode 100644 vhosts/blog/nuldoc-src/pages/post.tsx delete mode 100644 vhosts/blog/nuldoc-src/pages/post_list.tsx delete mode 100644 vhosts/blog/nuldoc-src/pages/slide.tsx delete mode 100644 vhosts/blog/nuldoc-src/pages/slide_list.tsx delete mode 100644 vhosts/blog/nuldoc-src/pages/tag.tsx delete mode 100644 vhosts/blog/nuldoc-src/pages/tag_list.tsx delete mode 100644 vhosts/blog/nuldoc-src/pages/tagged_page.ts (limited to 'vhosts/blog/nuldoc-src/pages') diff --git a/vhosts/blog/nuldoc-src/pages/AboutPage.tsx b/vhosts/blog/nuldoc-src/pages/AboutPage.tsx new file mode 100644 index 00000000..0000edf5 --- /dev/null +++ b/vhosts/blog/nuldoc-src/pages/AboutPage.tsx @@ -0,0 +1,94 @@ +import GlobalFooter from "../components/GlobalFooter.tsx"; +import GlobalHeader from "../components/GlobalHeader.tsx"; +import PageLayout from "../components/PageLayout.tsx"; +import StaticScript from "../components/StaticScript.tsx"; +import { Config } from "../config.ts"; +import { dateToString } from "../revision.ts"; +import { getPostPublishedDate } from "../generators/post.ts"; +import { SlidePage } from "../generators/slide.ts"; + +export default function AboutPage( + slides: SlidePage[], + config: Config, +) { + return ( + + + +
+
+
+

nsfisis

+
+ + +
+ +
+
+
+
+

読み方

+

+ 読み方は決めていません。音にする必要があるときは本名である「いまむら」をお使いください。 +

+
+
+

アカウント

+ +
+
+

仕事

+ +
+
+

登壇

+ +
+
+
+
+ + +
+ ); +} diff --git a/vhosts/blog/nuldoc-src/pages/HomePage.tsx b/vhosts/blog/nuldoc-src/pages/HomePage.tsx new file mode 100644 index 00000000..8850d039 --- /dev/null +++ b/vhosts/blog/nuldoc-src/pages/HomePage.tsx @@ -0,0 +1,53 @@ +import GlobalFooter from "../components/GlobalFooter.tsx"; +import GlobalHeader from "../components/GlobalHeader.tsx"; +import PageLayout from "../components/PageLayout.tsx"; +import { Config } from "../config.ts"; + +export default function HomePage(config: Config) { + return ( + + + +
+ +
+ + +
+ ); +} diff --git a/vhosts/blog/nuldoc-src/pages/NotFoundPage.tsx b/vhosts/blog/nuldoc-src/pages/NotFoundPage.tsx new file mode 100644 index 00000000..9631fef2 --- /dev/null +++ b/vhosts/blog/nuldoc-src/pages/NotFoundPage.tsx @@ -0,0 +1,27 @@ +import GlobalFooter from "../components/GlobalFooter.tsx"; +import GlobalHeader from "../components/GlobalHeader.tsx"; +import PageLayout from "../components/PageLayout.tsx"; +import { Config } from "../config.ts"; + +export default function NotFoundPage( + config: Config, +) { + return ( + + + +
+
+
404
+
+
+ + +
+ ); +} diff --git a/vhosts/blog/nuldoc-src/pages/PostListPage.tsx b/vhosts/blog/nuldoc-src/pages/PostListPage.tsx new file mode 100644 index 00000000..3fcfbf1f --- /dev/null +++ b/vhosts/blog/nuldoc-src/pages/PostListPage.tsx @@ -0,0 +1,41 @@ +import GlobalFooter from "../components/GlobalFooter.tsx"; +import GlobalHeader from "../components/GlobalHeader.tsx"; +import PageLayout from "../components/PageLayout.tsx"; +import PostPageEntry from "../components/PostPageEntry.tsx"; +import { Config } from "../config.ts"; +import { dateToString } from "../revision.ts"; +import { getPostPublishedDate, PostPage } from "../generators/post.ts"; + +export default function PostListPage( + posts: PostPage[], + config: Config, +) { + const pageTitle = "投稿一覧"; + + return ( + + + +
+
+

{pageTitle}

+
+ {Array.from(posts).sort((a, b) => { + const ta = dateToString(getPostPublishedDate(a)); + const tb = dateToString(getPostPublishedDate(b)); + if (ta > tb) return -1; + if (ta < tb) return 1; + return 0; + }).map((post) => )} +
+ + +
+ ); +} diff --git a/vhosts/blog/nuldoc-src/pages/PostPage.tsx b/vhosts/blog/nuldoc-src/pages/PostPage.tsx new file mode 100644 index 00000000..e6aa83aa --- /dev/null +++ b/vhosts/blog/nuldoc-src/pages/PostPage.tsx @@ -0,0 +1,74 @@ +import GlobalFooter from "../components/GlobalFooter.tsx"; +import GlobalHeader from "../components/GlobalHeader.tsx"; +import PageLayout from "../components/PageLayout.tsx"; +import { Config, getTagLabel } from "../config.ts"; +import { Element } from "../dom.ts"; +import { Document } from "../ndoc/document.ts"; +import { dateToString } from "../revision.ts"; +import { getPostPublishedDate } from "../generators/post.ts"; + +export default function PostPage( + doc: Document, + config: Config, +) { + return ( + getTagLabel(config, slug))} + metaTitle={`${doc.title}|${config.blog.siteName}`} + requiresSyntaxHighlight + config={config} + > + + +
+
+
+

{doc.title}

+ {doc.tags.length !== 0 && ( + + )} +
+
+
+

更新履歴

+
    + {doc.revisions.map((rev) => ( +
  1. + + {`: ${rev.remark}`} +
  2. + ))} +
+
+ { + // TODO: refactor + (doc.root.children[0] as Element).children + } + { + // TODO: footnotes + //
+ // <% for footnote in footnotes %> + //
+ // <%= footnote.index %>. <%= footnote.text %> + //
+ // <% end %> + //
+ } +
+
+
+ + +
+ ); +} diff --git a/vhosts/blog/nuldoc-src/pages/SlideListPage.tsx b/vhosts/blog/nuldoc-src/pages/SlideListPage.tsx new file mode 100644 index 00000000..44d6afff --- /dev/null +++ b/vhosts/blog/nuldoc-src/pages/SlideListPage.tsx @@ -0,0 +1,42 @@ +import GlobalFooter from "../components/GlobalFooter.tsx"; +import GlobalHeader from "../components/GlobalHeader.tsx"; +import PageLayout from "../components/PageLayout.tsx"; +import SlidePageEntry from "../components/SlidePageEntry.tsx"; +import { Config } from "../config.ts"; +import { dateToString } from "../revision.ts"; +import { getPostPublishedDate } from "../generators/post.ts"; +import { SlidePage } from "../generators/slide.ts"; + +export default function SlideListPage( + slides: SlidePage[], + config: Config, +) { + const pageTitle = "スライド一覧"; + + return ( + + + +
+
+

{pageTitle}

+
+ {Array.from(slides).sort((a, b) => { + const ta = dateToString(getPostPublishedDate(a)); + const tb = dateToString(getPostPublishedDate(b)); + if (ta > tb) return -1; + if (ta < tb) return 1; + return 0; + }).map((slide) => )} +
+ + +
+ ); +} diff --git a/vhosts/blog/nuldoc-src/pages/SlidePage.tsx b/vhosts/blog/nuldoc-src/pages/SlidePage.tsx new file mode 100644 index 00000000..6d167036 --- /dev/null +++ b/vhosts/blog/nuldoc-src/pages/SlidePage.tsx @@ -0,0 +1,70 @@ +import GlobalFooter from "../components/GlobalFooter.tsx"; +import GlobalHeader from "../components/GlobalHeader.tsx"; +import PageLayout from "../components/PageLayout.tsx"; +import StaticScript from "../components/StaticScript.tsx"; +import { Config, getTagLabel } from "../config.ts"; +import { dateToString } from "../revision.ts"; +import { Slide } from "../slide/slide.ts"; +import { getPostPublishedDate } from "../generators/post.ts"; + +export default function SlidePage( + slide: Slide, + config: Config, +) { + return ( + getTagLabel(config, slug))} + metaTitle={`${slide.event} (${slide.talkType})|${config.blog.siteName}`} + requiresSyntaxHighlight + config={config} + > + + +
+
+
+

{slide.title}

+ {slide.tags.length !== 0 && ( + + )} +
+
+
+

更新履歴

+
    + {slide.revisions.map((rev) => ( +
  1. + + {`: ${rev.remark}`} +
  2. + ))} +
+
+ +
+ + +
+ +
+
+
+ + +
+ ); +} diff --git a/vhosts/blog/nuldoc-src/pages/TagListPage.tsx b/vhosts/blog/nuldoc-src/pages/TagListPage.tsx new file mode 100644 index 00000000..cdb83ea5 --- /dev/null +++ b/vhosts/blog/nuldoc-src/pages/TagListPage.tsx @@ -0,0 +1,57 @@ +import GlobalFooter from "../components/GlobalFooter.tsx"; +import GlobalHeader from "../components/GlobalHeader.tsx"; +import PageLayout from "../components/PageLayout.tsx"; +import { Config } from "../config.ts"; +import { TagPage } from "../generators/tag.ts"; + +export default function TagListPage( + tags: TagPage[], + config: Config, +) { + const pageTitle = "タグ一覧"; + + return ( + + + +
+
+

{pageTitle}

+
+ {Array.from(tags).sort((a, b) => { + const ta = a.tagSlug; + const tb = b.tagSlug; + if (ta < tb) return -1; + if (ta > tb) return 1; + return 0; + }).map((tag) => ( + + ))} +
+ + +
+ ); +} diff --git a/vhosts/blog/nuldoc-src/pages/TagPage.tsx b/vhosts/blog/nuldoc-src/pages/TagPage.tsx new file mode 100644 index 00000000..568dfaa6 --- /dev/null +++ b/vhosts/blog/nuldoc-src/pages/TagPage.tsx @@ -0,0 +1,43 @@ +import GlobalFooter from "../components/GlobalFooter.tsx"; +import GlobalHeader from "../components/GlobalHeader.tsx"; +import PageLayout from "../components/PageLayout.tsx"; +import PostPageEntry from "../components/PostPageEntry.tsx"; +import SlidePageEntry from "../components/SlidePageEntry.tsx"; +import { Config, getTagLabel } from "../config.ts"; +import { getPostPublishedDate } from "../generators/post.ts"; +import { TaggedPage } from "../generators/tagged_page.ts"; + +export default function TagPage( + tagSlug: string, + pages: TaggedPage[], + config: Config, +) { + const tagLabel = getTagLabel(config, tagSlug); + const pageTitle = `タグ「${tagLabel}」一覧`; + + return ( + + + +
+
+

{pageTitle}

+
+ {pages.map((page) => + "event" in page + ? + : + )} +
+ + +
+ ); +} diff --git a/vhosts/blog/nuldoc-src/pages/about.tsx b/vhosts/blog/nuldoc-src/pages/about.tsx deleted file mode 100644 index 91d7fee4..00000000 --- a/vhosts/blog/nuldoc-src/pages/about.tsx +++ /dev/null @@ -1,105 +0,0 @@ -import GlobalFooter from "../components/GlobalFooter.tsx"; -import GlobalHeader from "../components/GlobalHeader.tsx"; -import PageLayout from "../components/PageLayout.tsx"; -import StaticScript from "../components/StaticScript.tsx"; -import { Config } from "../config.ts"; -import { renderToDOM } from "../jsx/render.ts"; -import { Page } from "../page.ts"; -import { dateToString } from "../revision.ts"; -import { getPostPublishedDate } from "./post.tsx"; -import { SlidePage } from "./slide.tsx"; - -export type AboutPage = Page; - -export async function generateAboutPage( - slides: SlidePage[], - config: Config, -): Promise { - const html = await renderToDOM( - - - -
-
-
-

nsfisis

-
- - -
- -
-
-
-
-

読み方

-

- 読み方は決めていません。音にする必要があるときは本名である「いまむら」をお使いください。 -

-
-
-

アカウント

- -
-
-

仕事

- -
-
-

登壇

- -
-
-
-
- - -
, - ); - - return { - root: html, - renderer: "html", - destFilePath: "/about/index.html", - href: "/about/", - }; -} diff --git a/vhosts/blog/nuldoc-src/pages/home.tsx b/vhosts/blog/nuldoc-src/pages/home.tsx deleted file mode 100644 index a9a5d542..00000000 --- a/vhosts/blog/nuldoc-src/pages/home.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import GlobalFooter from "../components/GlobalFooter.tsx"; -import { renderToDOM } from "../jsx/render.ts"; -import GlobalHeader from "../components/GlobalHeader.tsx"; -import PageLayout from "../components/PageLayout.tsx"; -import { Config } from "../config.ts"; -import { Page } from "../page.ts"; - -export type HomePage = Page; - -export async function generateHomePage(config: Config): Promise { - const html = await renderToDOM( - - - -
- -
- - -
, - ); - - return { - root: html, - renderer: "html", - destFilePath: "/index.html", - href: "/", - }; -} diff --git a/vhosts/blog/nuldoc-src/pages/not_found.tsx b/vhosts/blog/nuldoc-src/pages/not_found.tsx deleted file mode 100644 index 27be0738..00000000 --- a/vhosts/blog/nuldoc-src/pages/not_found.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import GlobalFooter from "../components/GlobalFooter.tsx"; -import { renderToDOM } from "../jsx/render.ts"; -import GlobalHeader from "../components/GlobalHeader.tsx"; -import PageLayout from "../components/PageLayout.tsx"; -import { Config } from "../config.ts"; -import { Page } from "../page.ts"; - -export type NotFoundPage = Page; - -export async function generateNotFoundPage( - config: Config, -): Promise { - const html = await renderToDOM( - - - -
-
-
404
-
-
- - -
, - ); - - return { - root: html, - renderer: "html", - destFilePath: "/404.html", - href: "/404.html", - }; -} diff --git a/vhosts/blog/nuldoc-src/pages/post.tsx b/vhosts/blog/nuldoc-src/pages/post.tsx deleted file mode 100644 index 541c33e3..00000000 --- a/vhosts/blog/nuldoc-src/pages/post.tsx +++ /dev/null @@ -1,123 +0,0 @@ -import { join } from "std/path/mod.ts"; -import { renderToDOM } from "../jsx/render.ts"; -import GlobalFooter from "../components/GlobalFooter.tsx"; -import GlobalHeader from "../components/GlobalHeader.tsx"; -import PageLayout from "../components/PageLayout.tsx"; -import { Config, getTagLabel } from "../config.ts"; -import { Element } from "../dom.ts"; -import { Document } from "../ndoc/document.ts"; -import { Page } from "../page.ts"; -import { Date, dateToString, Revision } from "../revision.ts"; - -export interface PostPage extends Page { - title: string; - description: string; - tags: string[]; - revisions: Revision[]; - published: Date; - updated: Date; - uuid: string; -} - -export function getPostPublishedDate(page: { revisions: Revision[] }): Date { - for (const rev of page.revisions) { - if (!rev.isInternal) { - return rev.date; - } - } - return page.revisions[0].date; -} - -export function getPostUpdatedDate(page: { revisions: Revision[] }): Date { - return page.revisions[page.revisions.length - 1].date; -} - -export function postHasAnyUpdates(page: { revisions: Revision[] }): boolean { - return 2 <= page.revisions.filter((rev) => !rev.isInternal).length; -} - -export async function generatePostPage( - doc: Document, - config: Config, -): Promise { - const html = await renderToDOM( - getTagLabel(config, slug))} - metaTitle={`${doc.title}|${config.blog.siteName}`} - requiresSyntaxHighlight - config={config} - > - - -
-
-
-

{doc.title}

- {doc.tags.length !== 0 && ( - - )} -
-
-
-

更新履歴

-
    - {doc.revisions.map((rev) => ( -
  1. - - {`: ${rev.remark}`} -
  2. - ))} -
-
- { - // TODO: refactor - (doc.root.children[0] as Element).children - } - { - // TODO: footnotes - //
- // <% for footnote in footnotes %> - //
- // <%= footnote.index %>. <%= footnote.text %> - //
- // <% end %> - //
- } -
-
-
- - -
, - ); - - const cwd = Deno.cwd(); - const contentDir = join(cwd, config.locations.contentDir); - const destFilePath = join( - doc.sourceFilePath.replace(contentDir, "").replace(".ndoc", ""), - "index.html", - ); - return { - root: html, - renderer: "html", - destFilePath: destFilePath, - href: destFilePath.replace("index.html", ""), - title: doc.title, - description: doc.description, - tags: doc.tags, - revisions: doc.revisions, - published: getPostPublishedDate(doc), - updated: getPostUpdatedDate(doc), - uuid: doc.uuid, - }; -} diff --git a/vhosts/blog/nuldoc-src/pages/post_list.tsx b/vhosts/blog/nuldoc-src/pages/post_list.tsx deleted file mode 100644 index 3cf17df4..00000000 --- a/vhosts/blog/nuldoc-src/pages/post_list.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import GlobalFooter from "../components/GlobalFooter.tsx"; -import { renderToDOM } from "../jsx/render.ts"; -import GlobalHeader from "../components/GlobalHeader.tsx"; -import PageLayout from "../components/PageLayout.tsx"; -import PostPageEntry from "../components/PostPageEntry.tsx"; -import { Config } from "../config.ts"; -import { Page } from "../page.ts"; -import { dateToString } from "../revision.ts"; -import { getPostPublishedDate, PostPage } from "./post.tsx"; - -export type PostListPage = Page; - -export async function generatePostListPage( - posts: PostPage[], - config: Config, -): Promise { - const pageTitle = "投稿一覧"; - - const html = await renderToDOM( - - - -
-
-

{pageTitle}

-
- {Array.from(posts).sort((a, b) => { - const ta = dateToString(getPostPublishedDate(a)); - const tb = dateToString(getPostPublishedDate(b)); - if (ta > tb) return -1; - if (ta < tb) return 1; - return 0; - }).map((post) => )} -
- - -
, - ); - - return { - root: html, - renderer: "html", - destFilePath: "/posts/index.html", - href: "/posts/", - }; -} diff --git a/vhosts/blog/nuldoc-src/pages/slide.tsx b/vhosts/blog/nuldoc-src/pages/slide.tsx deleted file mode 100644 index 843f539b..00000000 --- a/vhosts/blog/nuldoc-src/pages/slide.tsx +++ /dev/null @@ -1,109 +0,0 @@ -import { join } from "std/path/mod.ts"; -import { renderToDOM } from "../jsx/render.ts"; -import GlobalFooter from "../components/GlobalFooter.tsx"; -import GlobalHeader from "../components/GlobalHeader.tsx"; -import PageLayout from "../components/PageLayout.tsx"; -import StaticScript from "../components/StaticScript.tsx"; -import { Config, getTagLabel } from "../config.ts"; -import { Page } from "../page.ts"; -import { Date, dateToString, Revision } from "../revision.ts"; -import { Slide } from "../slide/slide.ts"; -import { getPostPublishedDate, getPostUpdatedDate } from "./post.tsx"; - -export interface SlidePage extends Page { - title: string; - description: string; - event: string; - talkType: string; - slideLink: string; - tags: string[]; - revisions: Revision[]; - published: Date; - updated: Date; - uuid: string; -} - -export async function generateSlidePage( - slide: Slide, - config: Config, -): Promise { - const html = await renderToDOM( - getTagLabel(config, slug))} - metaTitle={`${slide.event} (${slide.talkType})|${config.blog.siteName}`} - requiresSyntaxHighlight - config={config} - > - - -
-
-
-

{slide.title}

- {slide.tags.length !== 0 && ( - - )} -
-
-
-

更新履歴

-
    - {slide.revisions.map((rev) => ( -
  1. - - {`: ${rev.remark}`} -
  2. - ))} -
-
- -
- - -
- -
-
-
- - -
, - ); - - const cwd = Deno.cwd(); - const contentDir = join(cwd, config.locations.contentDir); - const destFilePath = join( - slide.sourceFilePath.replace(contentDir, "").replace(".toml", ""), - "index.html", - ); - return { - root: html, - renderer: "html", - destFilePath: destFilePath, - href: destFilePath.replace("index.html", ""), - title: slide.title, - description: `登壇: ${slide.event} (${slide.talkType})`, - event: slide.event, - talkType: slide.talkType, - slideLink: slide.slideLink, - tags: slide.tags, - revisions: slide.revisions, - published: getPostPublishedDate(slide), - updated: getPostUpdatedDate(slide), - uuid: slide.uuid, - }; -} diff --git a/vhosts/blog/nuldoc-src/pages/slide_list.tsx b/vhosts/blog/nuldoc-src/pages/slide_list.tsx deleted file mode 100644 index e42cfcea..00000000 --- a/vhosts/blog/nuldoc-src/pages/slide_list.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import GlobalFooter from "../components/GlobalFooter.tsx"; -import { renderToDOM } from "../jsx/render.ts"; -import GlobalHeader from "../components/GlobalHeader.tsx"; -import PageLayout from "../components/PageLayout.tsx"; -import SlidePageEntry from "../components/SlidePageEntry.tsx"; -import { Config } from "../config.ts"; -import { Page } from "../page.ts"; -import { dateToString } from "../revision.ts"; -import { getPostPublishedDate } from "./post.tsx"; -import { SlidePage } from "./slide.tsx"; - -export type SlideListPage = Page; - -export async function generateSlideListPage( - slides: SlidePage[], - config: Config, -): Promise { - const pageTitle = "スライド一覧"; - - const html = await renderToDOM( - - - -
-
-

{pageTitle}

-
- {Array.from(slides).sort((a, b) => { - const ta = dateToString(getPostPublishedDate(a)); - const tb = dateToString(getPostPublishedDate(b)); - if (ta > tb) return -1; - if (ta < tb) return 1; - return 0; - }).map((slide) => )} -
- - -
, - ); - - return { - root: html, - renderer: "html", - destFilePath: "/slides/index.html", - href: "/slides/", - }; -} diff --git a/vhosts/blog/nuldoc-src/pages/tag.tsx b/vhosts/blog/nuldoc-src/pages/tag.tsx deleted file mode 100644 index f7df1f13..00000000 --- a/vhosts/blog/nuldoc-src/pages/tag.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import GlobalFooter from "../components/GlobalFooter.tsx"; -import { renderToDOM } from "../jsx/render.ts"; -import GlobalHeader from "../components/GlobalHeader.tsx"; -import PageLayout from "../components/PageLayout.tsx"; -import PostPageEntry from "../components/PostPageEntry.tsx"; -import SlidePageEntry from "../components/SlidePageEntry.tsx"; -import { Config, getTagLabel } from "../config.ts"; -import { Page } from "../page.ts"; -import { getPostPublishedDate } from "./post.tsx"; -import { TaggedPage } from "./tagged_page.ts"; - -export interface TagPage extends Page { - tagSlug: string; - tagLabel: string; - numOfPosts: number; - numOfSlides: number; -} - -export async function generateTagPage( - tagSlug: string, - pages: TaggedPage[], - config: Config, -): Promise { - const tagLabel = getTagLabel(config, tagSlug); - const pageTitle = `タグ「${tagLabel}」一覧`; - - const html = await renderToDOM( - - - -
-
-

{pageTitle}

-
- {pages.map((page) => - "event" in page - ? - : - )} -
- - -
, - ); - - return { - root: html, - renderer: "html", - destFilePath: `/tags/${tagSlug}/index.html`, - href: `/tags/${tagSlug}/`, - tagSlug: tagSlug, - tagLabel: tagLabel, - numOfPosts: pages.filter((p) => !("event" in p)).length, - numOfSlides: pages.filter((p) => "event" in p).length, - }; -} diff --git a/vhosts/blog/nuldoc-src/pages/tag_list.tsx b/vhosts/blog/nuldoc-src/pages/tag_list.tsx deleted file mode 100644 index 728384f4..00000000 --- a/vhosts/blog/nuldoc-src/pages/tag_list.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import GlobalFooter from "../components/GlobalFooter.tsx"; -import { renderToDOM } from "../jsx/render.ts"; -import GlobalHeader from "../components/GlobalHeader.tsx"; -import PageLayout from "../components/PageLayout.tsx"; -import { Config } from "../config.ts"; -import { Page } from "../page.ts"; -import { TagPage } from "./tag.tsx"; - -export type TagListPage = Page; - -export async function generateTagListPage( - tags: TagPage[], - config: Config, -): Promise { - const pageTitle = "タグ一覧"; - - const html = await renderToDOM( - - - -
-
-

{pageTitle}

-
- {Array.from(tags).sort((a, b) => { - const ta = a.tagSlug; - const tb = b.tagSlug; - if (ta < tb) return -1; - if (ta > tb) return 1; - return 0; - }).map((tag) => ( - - ))} -
- - -
, - ); - - return { - root: html, - renderer: "html", - destFilePath: "/tags/index.html", - href: "/tags/", - }; -} diff --git a/vhosts/blog/nuldoc-src/pages/tagged_page.ts b/vhosts/blog/nuldoc-src/pages/tagged_page.ts deleted file mode 100644 index 026ca91f..00000000 --- a/vhosts/blog/nuldoc-src/pages/tagged_page.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { PostPage } from "./post.tsx"; -import { SlidePage } from "./slide.tsx"; - -export type TaggedPage = PostPage | SlidePage; -- cgit v1.2.3-70-g09d2