summaryrefslogtreecommitdiffhomepage
path: root/vhosts/blog/nuldoc-src/pages/not_found.ts
blob: dcc3046e1e0854354a9870dde71111992a4c51a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { globalFooter } from "../components/global_footer.ts";
import { globalHeader } from "../components/global_header.ts";
import { pageLayout } from "../components/page_layout.ts";
import { Config } from "../config.ts";
import { el, text } from "../dom.ts";
import { Page } from "../page.ts";

export type NotFoundPage = Page;

export async function generateNotFoundPage(
  config: Config,
): Promise<NotFoundPage> {
  const body = el(
    "body",
    [["class", "single"]],
    globalHeader(config),
    el(
      "main",
      [["class", "main"]],
      el(
        "article",
        [],
        el(
          "div",
          [["class", "not-found"]],
          text("404"),
        ),
      ),
    ),
    globalFooter(config),
  );

  const html = await pageLayout(
    {
      metaCopyrightYear: config.blog.siteCopyrightYear,
      metaDescription: "リクエストされたページが見つかりません",
      metaKeywords: [],
      metaTitle: `Page Not Found|${config.blog.siteName}`,
      requiresSyntaxHighlight: false,
    },
    body,
    config,
  );

  return {
    root: el("__root__", [], html),
    renderer: "html",
    destFilePath: "/404.html",
    href: "/404.html",
  };
}