From b712e14b622aaa76f8b1a5ccfa7b21c9ba1c6d03 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 18 Mar 2023 19:12:38 +0900 Subject: fix: 404 page --- content/404.html | 31 ------------- nuldoc-src/commands/build.ts | 7 +++ nuldoc-src/pages/not_found.ts | 51 ++++++++++++++++++++++ public/404.html | 22 +++++++--- public/about/index.html | 2 +- public/posts/2021-03-05/my-first-post/index.html | 2 +- public/posts/2021-03-30/phperkaigi-2021/index.html | 2 +- .../index.html | 2 +- .../python-unbound-local-error/index.html | 2 +- .../ruby-detect-running-implementation/index.html | 2 +- .../ruby-then-keyword-and-case-in/index.html | 2 +- .../rust-where-are-primitive-types-from/index.html | 2 +- .../index.html | 2 +- .../vim-swap-order-of-selected-lines/index.html | 2 +- .../2022-04-09/phperkaigi-2022-tokens/index.html | 2 +- .../index.html | 2 +- public/posts/2022-05-01/phperkaigi-2022/index.html | 2 +- .../php-conference-okinawa-code-golf/index.html | 2 +- .../index.html | 2 +- .../index.html | 2 +- .../phperkaigi-2023-unused-token-quiz-1/index.html | 2 +- .../setup-server-for-this-site/index.html | 2 +- .../phperkaigi-2023-unused-token-quiz-2/index.html | 2 +- .../phperkaigi-2023-unused-token-quiz-3/index.html | 2 +- .../rewrite-this-blog-generator/index.html | 2 +- public/posts/index.html | 2 +- public/style.css | 5 +++ public/tags/conference/index.html | 2 +- public/tags/cpp/index.html | 2 +- public/tags/cpp17/index.html | 2 +- public/tags/note-to-self/index.html | 2 +- public/tags/php/index.html | 2 +- public/tags/phpcon/index.html | 2 +- public/tags/phperkaigi/index.html | 2 +- public/tags/python/index.html | 2 +- public/tags/python3/index.html | 2 +- public/tags/ruby/index.html | 2 +- public/tags/ruby3/index.html | 2 +- public/tags/rust/index.html | 2 +- public/tags/vim/index.html | 2 +- static/style.css | 5 +++ 41 files changed, 120 insertions(+), 71 deletions(-) delete mode 100644 content/404.html create mode 100644 nuldoc-src/pages/not_found.ts diff --git a/content/404.html b/content/404.html deleted file mode 100644 index bd00a94..0000000 --- a/content/404.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - Page Not Found | REPL: Rest-Eat-Program Loop - - - -
- -
-
-
-
- 404 -
-
-
- - - diff --git a/nuldoc-src/commands/build.ts b/nuldoc-src/commands/build.ts index ef529e0..d523861 100644 --- a/nuldoc-src/commands/build.ts +++ b/nuldoc-src/commands/build.ts @@ -6,6 +6,7 @@ import { parseDocBookFile } from "../docbook/parse.ts"; import { Page } from "../page.ts"; import { render } from "../render.ts"; import { generateAboutPage } from "../pages/about.ts"; +import { generateNotFoundPage } from "../pages/not_found.ts"; import { generatePostPage, getPostCreatedDate, @@ -19,6 +20,7 @@ export async function runBuildCommand(config: Config) { await buildPostListPage(posts, config); await buildTagPages(posts, config); await buildAboutPage(config); + await buildNotFoundPage(config); await copyStaticFiles(config); } @@ -64,6 +66,11 @@ async function buildAboutPage(config: Config) { await writePage(aboutPage, config); } +async function buildNotFoundPage(config: Config) { + const notFoundPage = await generateNotFoundPage(config); + await writePage(notFoundPage, config); +} + async function buildTagPages(posts: PostPage[], config: Config) { const tagsAndPosts = collectTags(posts); for (const [tag, posts] of tagsAndPosts) { diff --git a/nuldoc-src/pages/not_found.ts b/nuldoc-src/pages/not_found.ts new file mode 100644 index 0000000..65938dd --- /dev/null +++ b/nuldoc-src/pages/not_found.ts @@ -0,0 +1,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 { + 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", + requiresSyntaxHighlight: false, + }, + body, + config, + ); + + return { + root: el("__root__", [], html), + renderer: "html", + destFilePath: "/404.html", + href: "/404.html", + }; +} diff --git a/public/404.html b/public/404.html index bd00a94..cf6553a 100644 --- a/public/404.html +++ b/public/404.html @@ -5,16 +5,28 @@ + Page Not Found | REPL: Rest-Eat-Program Loop - + - +
diff --git a/public/about/index.html b/public/about/index.html index 6cb371c..a2cf3c9 100644 --- a/public/about/index.html +++ b/public/about/index.html @@ -8,7 +8,7 @@ About | REPL: Rest-Eat-Program Loop - +
diff --git a/public/posts/2021-03-05/my-first-post/index.html b/public/posts/2021-03-05/my-first-post/index.html index 9ef8317..ac1044d 100644 --- a/public/posts/2021-03-05/my-first-post/index.html +++ b/public/posts/2021-03-05/my-first-post/index.html @@ -8,7 +8,7 @@ My First Post | REPL: Rest-Eat-Program Loop - + diff --git a/public/posts/2021-03-30/phperkaigi-2021/index.html b/public/posts/2021-03-30/phperkaigi-2021/index.html index 2adff51..49338c5 100644 --- a/public/posts/2021-03-30/phperkaigi-2021/index.html +++ b/public/posts/2021-03-30/phperkaigi-2021/index.html @@ -9,7 +9,7 @@ PHPerKaigi 2021 | REPL: Rest-Eat-Program Loop - + diff --git a/public/posts/2021-10-02/cpp-you-can-use-keywords-in-attributes/index.html b/public/posts/2021-10-02/cpp-you-can-use-keywords-in-attributes/index.html index 75ae666..b1da2a5 100644 --- a/public/posts/2021-10-02/cpp-you-can-use-keywords-in-attributes/index.html +++ b/public/posts/2021-10-02/cpp-you-can-use-keywords-in-attributes/index.html @@ -9,7 +9,7 @@ 【C++】 属性構文の属性名にはキーワードが使える | REPL: Rest-Eat-Program Loop - + diff --git a/public/posts/2021-10-02/python-unbound-local-error/index.html b/public/posts/2021-10-02/python-unbound-local-error/index.html index a39be48..7c951cc 100644 --- a/public/posts/2021-10-02/python-unbound-local-error/index.html +++ b/public/posts/2021-10-02/python-unbound-local-error/index.html @@ -9,7 +9,7 @@ 【Python】 クロージャとUnboundLocalError: local variable 'x' referenced before assignment | REPL: Rest-Eat-Program Loop - + diff --git a/public/posts/2021-10-02/ruby-detect-running-implementation/index.html b/public/posts/2021-10-02/ruby-detect-running-implementation/index.html index 4a2315c..0b25546 100644 --- a/public/posts/2021-10-02/ruby-detect-running-implementation/index.html +++ b/public/posts/2021-10-02/ruby-detect-running-implementation/index.html @@ -9,7 +9,7 @@ 【Ruby】 自身を実行している処理系の種類を判定する | REPL: Rest-Eat-Program Loop - + diff --git a/public/posts/2021-10-02/ruby-then-keyword-and-case-in/index.html b/public/posts/2021-10-02/ruby-then-keyword-and-case-in/index.html index 765121c..7531bf3 100644 --- a/public/posts/2021-10-02/ruby-then-keyword-and-case-in/index.html +++ b/public/posts/2021-10-02/ruby-then-keyword-and-case-in/index.html @@ -9,7 +9,7 @@ 【Ruby】 then キーワードと case in | REPL: Rest-Eat-Program Loop - + diff --git a/public/posts/2021-10-02/rust-where-are-primitive-types-from/index.html b/public/posts/2021-10-02/rust-where-are-primitive-types-from/index.html index 7fc44c9..9014f7c 100644 --- a/public/posts/2021-10-02/rust-where-are-primitive-types-from/index.html +++ b/public/posts/2021-10-02/rust-where-are-primitive-types-from/index.html @@ -9,7 +9,7 @@ Rust のプリミティブ型はどこからやって来るか | REPL: Rest-Eat-Program Loop - + diff --git a/public/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre/index.html b/public/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre/index.html index f2b0ba5..b3c7715 100644 --- a/public/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre/index.html +++ b/public/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre/index.html @@ -9,7 +9,7 @@ 【Vim】 autocmd events の BufWrite/BufWritePre の違い | REPL: Rest-Eat-Program Loop - + diff --git a/public/posts/2021-10-02/vim-swap-order-of-selected-lines/index.html b/public/posts/2021-10-02/vim-swap-order-of-selected-lines/index.html index 5dacbd0..4f0c72a 100644 --- a/public/posts/2021-10-02/vim-swap-order-of-selected-lines/index.html +++ b/public/posts/2021-10-02/vim-swap-order-of-selected-lines/index.html @@ -9,7 +9,7 @@ Vimで選択した行の順番を入れ替える | REPL: Rest-Eat-Program Loop - + diff --git a/public/posts/2022-04-09/phperkaigi-2022-tokens/index.html b/public/posts/2022-04-09/phperkaigi-2022-tokens/index.html index 78f76c4..fdeb85b 100644 --- a/public/posts/2022-04-09/phperkaigi-2022-tokens/index.html +++ b/public/posts/2022-04-09/phperkaigi-2022-tokens/index.html @@ -9,7 +9,7 @@ PHPerKaigi 2022 トークン問題の解説 | REPL: Rest-Eat-Program Loop - + diff --git a/public/posts/2022-04-24/term-banner-write-tool-showing-banner-in-terminal/index.html b/public/posts/2022-04-24/term-banner-write-tool-showing-banner-in-terminal/index.html index 7d7c0f2..ff70a07 100644 --- a/public/posts/2022-04-24/term-banner-write-tool-showing-banner-in-terminal/index.html +++ b/public/posts/2022-04-24/term-banner-write-tool-showing-banner-in-terminal/index.html @@ -8,7 +8,7 @@ term-banner: ターミナルにバナーを表示するツールを書いた | REPL: Rest-Eat-Program Loop - + diff --git a/public/posts/2022-05-01/phperkaigi-2022/index.html b/public/posts/2022-05-01/phperkaigi-2022/index.html index 02d6c40..14900ff 100644 --- a/public/posts/2022-05-01/phperkaigi-2022/index.html +++ b/public/posts/2022-05-01/phperkaigi-2022/index.html @@ -9,7 +9,7 @@ PHPerKaigi 2022 | REPL: Rest-Eat-Program Loop - + diff --git a/public/posts/2022-08-27/php-conference-okinawa-code-golf/index.html b/public/posts/2022-08-27/php-conference-okinawa-code-golf/index.html index 6e82f8f..1149f75 100644 --- a/public/posts/2022-08-27/php-conference-okinawa-code-golf/index.html +++ b/public/posts/2022-08-27/php-conference-okinawa-code-golf/index.html @@ -9,7 +9,7 @@ PHP カンファレンス沖縄で出題されたコードゴルフの問題を解いてみた | REPL: Rest-Eat-Program Loop - + diff --git a/public/posts/2022-08-31/support-for-communty-is-employee-benefits/index.html b/public/posts/2022-08-31/support-for-communty-is-employee-benefits/index.html index 1c727d2..e7ff20f 100644 --- a/public/posts/2022-08-31/support-for-communty-is-employee-benefits/index.html +++ b/public/posts/2022-08-31/support-for-communty-is-employee-benefits/index.html @@ -8,7 +8,7 @@ 弊社の PHP Foundation への寄付に寄せて | REPL: Rest-Eat-Program Loop - + diff --git a/public/posts/2022-09-29/write-fizzbuzz-in-php-2-letters-per-line/index.html b/public/posts/2022-09-29/write-fizzbuzz-in-php-2-letters-per-line/index.html index e946180..5fd0050 100644 --- a/public/posts/2022-09-29/write-fizzbuzz-in-php-2-letters-per-line/index.html +++ b/public/posts/2022-09-29/write-fizzbuzz-in-php-2-letters-per-line/index.html @@ -9,7 +9,7 @@ 【PHP】 fizzbuzz を書く。1行あたり2文字で。 | REPL: Rest-Eat-Program Loop - + diff --git a/public/posts/2022-10-23/phperkaigi-2023-unused-token-quiz-1/index.html b/public/posts/2022-10-23/phperkaigi-2023-unused-token-quiz-1/index.html index 6c9b1e2..95bb097 100644 --- a/public/posts/2022-10-23/phperkaigi-2023-unused-token-quiz-1/index.html +++ b/public/posts/2022-10-23/phperkaigi-2023-unused-token-quiz-1/index.html @@ -9,7 +9,7 @@ PHPerKaigi 2023: ボツになったトークン問題 その 1 | REPL: Rest-Eat-Program Loop - + diff --git a/public/posts/2022-10-28/setup-server-for-this-site/index.html b/public/posts/2022-10-28/setup-server-for-this-site/index.html index cce6ff8..f416358 100644 --- a/public/posts/2022-10-28/setup-server-for-this-site/index.html +++ b/public/posts/2022-10-28/setup-server-for-this-site/index.html @@ -9,7 +9,7 @@ 【備忘録】 このサイト用の VPS をセットアップしたときのメモ | REPL: Rest-Eat-Program Loop - + diff --git a/public/posts/2022-11-19/phperkaigi-2023-unused-token-quiz-2/index.html b/public/posts/2022-11-19/phperkaigi-2023-unused-token-quiz-2/index.html index e97d3e1..6056e47 100644 --- a/public/posts/2022-11-19/phperkaigi-2023-unused-token-quiz-2/index.html +++ b/public/posts/2022-11-19/phperkaigi-2023-unused-token-quiz-2/index.html @@ -9,7 +9,7 @@ PHPerKaigi 2023: ボツになったトークン問題 その 2 | REPL: Rest-Eat-Program Loop - + diff --git a/public/posts/2023-01-10/phperkaigi-2023-unused-token-quiz-3/index.html b/public/posts/2023-01-10/phperkaigi-2023-unused-token-quiz-3/index.html index c98ee98..39dbf92 100644 --- a/public/posts/2023-01-10/phperkaigi-2023-unused-token-quiz-3/index.html +++ b/public/posts/2023-01-10/phperkaigi-2023-unused-token-quiz-3/index.html @@ -9,7 +9,7 @@ PHPerKaigi 2023: ボツになったトークン問題 その 3 | REPL: Rest-Eat-Program Loop - + diff --git a/public/posts/2023-03-10/rewrite-this-blog-generator/index.html b/public/posts/2023-03-10/rewrite-this-blog-generator/index.html index f1a21ea..f45df4d 100644 --- a/public/posts/2023-03-10/rewrite-this-blog-generator/index.html +++ b/public/posts/2023-03-10/rewrite-this-blog-generator/index.html @@ -8,7 +8,7 @@ このブログのジェネレータを書き直した | REPL: Rest-Eat-Program Loop - + diff --git a/public/posts/index.html b/public/posts/index.html index 5059af4..345def6 100644 --- a/public/posts/index.html +++ b/public/posts/index.html @@ -8,7 +8,7 @@ 投稿一覧 | REPL: Rest-Eat-Program Loop - +
diff --git a/public/style.css b/public/style.css index 953aaf4..a813c21 100644 --- a/public/style.css +++ b/public/style.css @@ -211,6 +211,11 @@ article.post-entry { color: #666; } +.not-found { + font-size: 8rem; + font-weight: bold; +} + @media screen and (max-width: 768px) { main { padding: 0 1rem; diff --git a/public/tags/conference/index.html b/public/tags/conference/index.html index 3a52dc3..02521a8 100644 --- a/public/tags/conference/index.html +++ b/public/tags/conference/index.html @@ -9,7 +9,7 @@ タグ「カンファレンス」一覧 | REPL: Rest-Eat-Program Loop - +
diff --git a/public/tags/cpp/index.html b/public/tags/cpp/index.html index d081460..3e069c9 100644 --- a/public/tags/cpp/index.html +++ b/public/tags/cpp/index.html @@ -9,7 +9,7 @@ タグ「C++」一覧 | REPL: Rest-Eat-Program Loop - +
diff --git a/public/tags/cpp17/index.html b/public/tags/cpp17/index.html index 61e05c2..832693f 100644 --- a/public/tags/cpp17/index.html +++ b/public/tags/cpp17/index.html @@ -9,7 +9,7 @@ タグ「C++ 17」一覧 | REPL: Rest-Eat-Program Loop - +
diff --git a/public/tags/note-to-self/index.html b/public/tags/note-to-self/index.html index b0f3f07..8de640b 100644 --- a/public/tags/note-to-self/index.html +++ b/public/tags/note-to-self/index.html @@ -9,7 +9,7 @@ タグ「備忘録」一覧 | REPL: Rest-Eat-Program Loop - +
diff --git a/public/tags/php/index.html b/public/tags/php/index.html index b3ab920..bea40e0 100644 --- a/public/tags/php/index.html +++ b/public/tags/php/index.html @@ -9,7 +9,7 @@ タグ「PHP」一覧 | REPL: Rest-Eat-Program Loop - +
diff --git a/public/tags/phpcon/index.html b/public/tags/phpcon/index.html index c97fc17..26758e5 100644 --- a/public/tags/phpcon/index.html +++ b/public/tags/phpcon/index.html @@ -9,7 +9,7 @@ タグ「PHP カンファレンス」一覧 | REPL: Rest-Eat-Program Loop - +
diff --git a/public/tags/phperkaigi/index.html b/public/tags/phperkaigi/index.html index eaa15da..5af63f3 100644 --- a/public/tags/phperkaigi/index.html +++ b/public/tags/phperkaigi/index.html @@ -9,7 +9,7 @@ タグ「PHPerKaigi」一覧 | REPL: Rest-Eat-Program Loop - +
diff --git a/public/tags/python/index.html b/public/tags/python/index.html index 4152e7f..3cdcb06 100644 --- a/public/tags/python/index.html +++ b/public/tags/python/index.html @@ -9,7 +9,7 @@ タグ「Python」一覧 | REPL: Rest-Eat-Program Loop - +
diff --git a/public/tags/python3/index.html b/public/tags/python3/index.html index 3d4f889..a40e37e 100644 --- a/public/tags/python3/index.html +++ b/public/tags/python3/index.html @@ -9,7 +9,7 @@ タグ「Python 3」一覧 | REPL: Rest-Eat-Program Loop - +
diff --git a/public/tags/ruby/index.html b/public/tags/ruby/index.html index 2f2909f..bd25370 100644 --- a/public/tags/ruby/index.html +++ b/public/tags/ruby/index.html @@ -9,7 +9,7 @@ タグ「Ruby」一覧 | REPL: Rest-Eat-Program Loop - +
diff --git a/public/tags/ruby3/index.html b/public/tags/ruby3/index.html index 9d68bd0..1eeac99 100644 --- a/public/tags/ruby3/index.html +++ b/public/tags/ruby3/index.html @@ -9,7 +9,7 @@ タグ「Ruby 3」一覧 | REPL: Rest-Eat-Program Loop - +
diff --git a/public/tags/rust/index.html b/public/tags/rust/index.html index c2b6fac..4aa764f 100644 --- a/public/tags/rust/index.html +++ b/public/tags/rust/index.html @@ -9,7 +9,7 @@ タグ「Rust」一覧 | REPL: Rest-Eat-Program Loop - +
diff --git a/public/tags/vim/index.html b/public/tags/vim/index.html index 65d0cfa..97d011a 100644 --- a/public/tags/vim/index.html +++ b/public/tags/vim/index.html @@ -9,7 +9,7 @@ タグ「Vim」一覧 | REPL: Rest-Eat-Program Loop - +
diff --git a/static/style.css b/static/style.css index 953aaf4..a813c21 100644 --- a/static/style.css +++ b/static/style.css @@ -211,6 +211,11 @@ article.post-entry { color: #666; } +.not-found { + font-size: 8rem; + font-weight: bold; +} + @media screen and (max-width: 768px) { main { padding: 0 1rem; -- cgit v1.2.3-70-g09d2