From d60f35288c9ee37f14f6f904208103db80c307ce Mon Sep 17 00:00:00 2001 From: scarf Date: Mon, 12 Feb 2024 03:35:42 +0900 Subject: [PATCH] feat: multilangauge and weekly digest (#2) * chore: use `deno.jsonc` * ci: allow empty tests * fix: rendering style * fix: date not being sorted properly * chore: organize pages * feat: nav bar * feat: multilangauge and weekly digest --- .github/workflows/test.yaml | 2 +- .gitignore | 1 + .vscode/settings.json | 2 +- _config.ts | 29 +- _includes/base.ts | 23 +- _includes/pages.ts | 8 + assets/global.css | 67 ++ assets/list.css | 15 - assets/pages.css | 12 + assets/style.css | 25 - deno.json => deno.jsonc | 4 +- deno.lock | 1426 +++++++++++++++++++++-------- index.page.ts | 125 ++- pages/{ => 2023/11}/2023-11-26.md | 4 + pages/{ => 2023/11}/2023-11-27.md | 0 pages/{ => 2023/11}/2023-11-28.md | 0 pages/{ => 2023/12}/2023-12-02.md | 0 pages/{ => 2023/12}/2023-12-03.md | 0 pages/{ => 2023/12}/2023-12-04.md | 0 pages/{ => 2023/12}/2023-12-06.md | 0 pages/{ => 2023/12}/2023-12-08.md | 0 pages/{ => 2023/12}/2023-12-09.md | 0 pages/{ => 2023/12}/2023-12-10.md | 0 pages/{ => 2023/12}/2023-12-11.md | 0 pages/_data.ts | 6 + pages/_data.yml | 1 - types.ts | 15 +- 27 files changed, 1299 insertions(+), 466 deletions(-) create mode 100644 _includes/pages.ts create mode 100644 assets/global.css delete mode 100644 assets/list.css create mode 100644 assets/pages.css delete mode 100644 assets/style.css rename deno.json => deno.jsonc (77%) rename pages/{ => 2023/11}/2023-11-26.md (98%) rename pages/{ => 2023/11}/2023-11-27.md (100%) rename pages/{ => 2023/11}/2023-11-28.md (100%) rename pages/{ => 2023/12}/2023-12-02.md (100%) rename pages/{ => 2023/12}/2023-12-03.md (100%) rename pages/{ => 2023/12}/2023-12-04.md (100%) rename pages/{ => 2023/12}/2023-12-06.md (100%) rename pages/{ => 2023/12}/2023-12-08.md (100%) rename pages/{ => 2023/12}/2023-12-09.md (100%) rename pages/{ => 2023/12}/2023-12-10.md (100%) rename pages/{ => 2023/12}/2023-12-11.md (100%) create mode 100644 pages/_data.ts delete mode 100644 pages/_data.yml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ee05b7c..7ff11e6 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -34,4 +34,4 @@ jobs: with: deno-version: ${{ matrix.deno }} - name: Run unit tests on Deno - run: deno test + run: deno test --allow-none diff --git a/.gitignore b/.gitignore index ca35be0..0d3b8d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ _site +pr.json diff --git a/.vscode/settings.json b/.vscode/settings.json index ea4e077..5601ac9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,7 +2,7 @@ "deno.enable": true, "deno.lint": true, "deno.unstable": true, - "deno.config": "./deno.json", + "deno.config": "./deno.jsonc", "[json][jsonc][markdown][typescript][typescriptreact]": { "editor.defaultFormatter": "denoland.vscode-deno" } diff --git a/_config.ts b/_config.ts index a9d77ef..cb55456 100644 --- a/_config.ts +++ b/_config.ts @@ -1,16 +1,33 @@ import { lume } from "./lume_core.ts" +import type { Processor } from "lume/core/processors.ts" + +import multilanguage from "lume/plugins/multilanguage.ts" import relativeUrls from "lume/plugins/relative_urls.ts" import inline from "lume/plugins/inline.ts" import minifyHTML from "lume/plugins/minify_html.ts" const site = lume() -site.copy([".css"]) -site.ignore("./README.md") -site.data("layout", "_includes/base.ts") -site.use(relativeUrls()) +site + .copy([".css"]) + .ignore("./README.md", "./CONTRIBUTING.md") + .data("layout", "_includes/base.ts") + +const addMeta: Processor = (pages) => + pages.forEach((page) => { + page.data.date = new Date(page.data.basename) + page.data.title = page.data.title ?? page.data.basename + }) + +site + .preprocess([".md"], addMeta) + .use(relativeUrls()) + .use(multilanguage({ languages: ["ko"] })) + if (Deno.env.get("MINIFY")) { - site.use(inline()) - site.use(minifyHTML()) + site + .use(inline()) + .use(minifyHTML()) } + export default site diff --git a/_includes/base.ts b/_includes/base.ts index a75876e..a0cecdd 100644 --- a/_includes/base.ts +++ b/_includes/base.ts @@ -1,5 +1,17 @@ export const repo = "https://github.com/scarf005/bn-blog" +const header = /*html*/ ` +
+

+ 카타클리즘: 밝은 밤 블로그 +

+ +
+` + const footer = /*html*/ `