diff --git a/.woodpecker.yml b/.woodpecker.yml index c9a3c12..5d340ad 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,8 +1,9 @@ pipeline: build: - image: klakegg/hugo:ext-pandoc-ci + image: node:18 commands: - - hugo --buildDrafts --minify --baseURL https://mzhang.io + - npm install + - npm run build deploy: image: alpine @@ -12,7 +13,7 @@ pipeline: - chmod 600 SSH_SECRET_KEY - mkdir -p ~/.ssh - echo "mzhang.io ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBzBZ+QmM4EO3Fwc1ZcvWV2IY9VF04T0H9brorGj9Udp" >> ~/.ssh/known_hosts - - rsync -azvrP -e "ssh -i SSH_SECRET_KEY" public/ sourcehutBuilds@mzhang.io:/mnt/storage/svcdata/blog-public - secrets: [ SSH_SECRET_KEY ] + - rsync -azvrP -e "ssh -i SSH_SECRET_KEY" dist/ sourcehutBuilds@mzhang.io:/mnt/storage/svcdata/blog-public + secrets: [SSH_SECRET_KEY] when: branch: master diff --git a/astro.config.ts b/astro.config.ts index f9b7542..2a8b6d5 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -2,9 +2,14 @@ import { defineConfig } from "astro/config"; import mdx from "@astrojs/mdx"; import sitemap from "@astrojs/sitemap"; +import { remarkReadingTime } from "./plugin/remark-reading-time"; // https://astro.build/config export default defineConfig({ site: "https://example.com", integrations: [mdx(), sitemap()], + markdown: { + syntaxHighlight: false, + remarkPlugins: [remarkReadingTime], + }, }); diff --git a/package-lock.json b/package-lock.json index e3b3591..44fbf80 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,9 +11,14 @@ "@astrojs/mdx": "^1.0.0", "@astrojs/rss": "^3.0.0", "@astrojs/sitemap": "^3.0.0", - "astro": "^3.0.3" + "astro": "^3.0.3", + "fork-awesome": "^1.2.0", + "lodash-es": "^4.17.21", + "mdast-util-to-string": "^4.0.0", + "reading-time": "^1.5.0" }, "devDependencies": { + "@types/lodash-es": "^4.17.9", "prettier": "^3.0.3", "prettier-plugin-astro": "^0.12.0", "sass": "^1.66.1" @@ -988,6 +993,21 @@ "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.30.tgz", "integrity": "sha512-sqm9g7mHlPY/43fcSNrCYfOeX9zkTTK+euO5E6+CVijSMm5tTjkVdwdqRkY3ljjIAf8679vps5jKUoJBCLsMDA==" }, + "node_modules/@types/lodash": { + "version": "4.14.197", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.197.tgz", + "integrity": "sha512-BMVOiWs0uNxHVlHBgzTIqJYmj+PgCo4euloGF+5m4okL3rEYzM2EEv78mw8zWSMM57dM7kVIgJ2QDvwHSoCI5g==", + "dev": true + }, + "node_modules/@types/lodash-es": { + "version": "4.17.9", + "resolved": "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.9.tgz", + "integrity": "sha512-ZTcmhiI3NNU7dEvWLZJkzG6ao49zOIjEgIE0RgV7wbPxU0f2xT3VSAHw2gmst8swH6V0YkLRGp4qPlX/6I90MQ==", + "dev": true, + "dependencies": { + "@types/lodash": "*" + } + }, "node_modules/@types/mdast": { "version": "3.0.12", "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.12.tgz", @@ -2085,6 +2105,14 @@ "pkg-dir": "^4.2.0" } }, + "node_modules/fork-awesome": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fork-awesome/-/fork-awesome-1.2.0.tgz", + "integrity": "sha512-MNwTBnnudMIweHfDtTY8TeR5fxIAZ2w9o8ITn5XDySqdxa4k5AH8IuAMa89RVxDxgPNlosZxqkFKN5UmHXuYSw==", + "engines": { + "node": ">=0.10.3" + } + }, "node_modules/format": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz", @@ -2772,6 +2800,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/lodash-es": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", + "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" + }, "node_modules/log-symbols": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-5.1.0.tgz", @@ -2906,6 +2939,18 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/mdast-util-from-markdown/node_modules/mdast-util-to-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-3.2.0.tgz", + "integrity": "sha512-V4Zn/ncyN1QNSqSBxTrMOLpjr+IKdHl2v3KVLoWmDPscP4r9GcCi71gjgvUV1SFSKh92AjAG4peFuBl2/YgCJg==", + "dependencies": { + "@types/mdast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/mdast-util-frontmatter": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mdast-util-frontmatter/-/mdast-util-frontmatter-1.0.1.tgz", @@ -3130,7 +3175,7 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/mdast-util-to-string": { + "node_modules/mdast-util-to-markdown/node_modules/mdast-util-to-string": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-3.2.0.tgz", "integrity": "sha512-V4Zn/ncyN1QNSqSBxTrMOLpjr+IKdHl2v3KVLoWmDPscP4r9GcCi71gjgvUV1SFSKh92AjAG4peFuBl2/YgCJg==", @@ -3142,6 +3187,26 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/mdast-util-to-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz", + "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==", + "dependencies": { + "@types/mdast": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-string/node_modules/@types/mdast": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.0.tgz", + "integrity": "sha512-YLeG8CujC9adtj/kuDzq1N4tCDYKoZ5l/bnjq8d74+t/3q/tHquJOJKUQXJrLCflOHpKjXgcI/a929gpmLOEng==", + "dependencies": { + "@types/unist": "*" + } + }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -4564,6 +4629,11 @@ "node": ">=8.10.0" } }, + "node_modules/reading-time": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/reading-time/-/reading-time-1.5.0.tgz", + "integrity": "sha512-onYyVhBNr4CmAxFsKS7bz+uTLRakypIe4R+5A824vBSkQy/hB3fZepoVEf8OVAxzLvK+H/jm9TzpI3ETSm64Kg==" + }, "node_modules/rehype": { "version": "12.0.1", "resolved": "https://registry.npmjs.org/rehype/-/rehype-12.0.1.tgz", diff --git a/package.json b/package.json index e918745..4b2a3ac 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,14 @@ "@astrojs/mdx": "^1.0.0", "@astrojs/rss": "^3.0.0", "@astrojs/sitemap": "^3.0.0", - "astro": "^3.0.3" + "astro": "^3.0.3", + "fork-awesome": "^1.2.0", + "lodash-es": "^4.17.21", + "mdast-util-to-string": "^4.0.0", + "reading-time": "^1.5.0" }, "devDependencies": { + "@types/lodash-es": "^4.17.9", "prettier": "^3.0.3", "prettier-plugin-astro": "^0.12.0", "sass": "^1.66.1" diff --git a/plugin/remark-reading-time.ts b/plugin/remark-reading-time.ts new file mode 100644 index 0000000..535540a --- /dev/null +++ b/plugin/remark-reading-time.ts @@ -0,0 +1,12 @@ +import getReadingTime from "reading-time"; +import { toString } from "mdast-util-to-string"; + +export function remarkReadingTime() { + return function (tree, { data }) { + const textOnPage = toString(tree); + const readingTime = getReadingTime(textOnPage); + // readingTime.text will give us minutes read as a friendly string, + // i.e. "3 min read" + data.astro.frontmatter.minutesRead = readingTime.text; + }; +} diff --git a/public/fork-awesome/forkawesome-webfont.eot b/public/fonts/forkawesome-webfont.eot similarity index 100% rename from public/fork-awesome/forkawesome-webfont.eot rename to public/fonts/forkawesome-webfont.eot diff --git a/public/fork-awesome/forkawesome-webfont.svg b/public/fonts/forkawesome-webfont.svg similarity index 100% rename from public/fork-awesome/forkawesome-webfont.svg rename to public/fonts/forkawesome-webfont.svg diff --git a/public/fork-awesome/forkawesome-webfont.ttf b/public/fonts/forkawesome-webfont.ttf similarity index 100% rename from public/fork-awesome/forkawesome-webfont.ttf rename to public/fonts/forkawesome-webfont.ttf diff --git a/public/fork-awesome/forkawesome-webfont.woff b/public/fonts/forkawesome-webfont.woff similarity index 100% rename from public/fork-awesome/forkawesome-webfont.woff rename to public/fonts/forkawesome-webfont.woff diff --git a/public/fork-awesome/forkawesome-webfont.woff2 b/public/fonts/forkawesome-webfont.woff2 similarity index 100% rename from public/fork-awesome/forkawesome-webfont.woff2 rename to public/fonts/forkawesome-webfont.woff2 diff --git a/public/fonts/patched/PragmataPro-Mono-Liga-Regular-Nerd-Font-Complete.woff2 b/public/fonts/patched/PragmataPro-Mono-Liga-Regular-Nerd-Font-Complete.woff2 new file mode 100644 index 0000000..f787350 Binary files /dev/null and b/public/fonts/patched/PragmataPro-Mono-Liga-Regular-Nerd-Font-Complete.woff2 differ diff --git a/src/assets/ctf/blender-objects.png b/src/assets/ctf/blender-objects.png new file mode 100644 index 0000000..3d2697e Binary files /dev/null and b/src/assets/ctf/blender-objects.png differ diff --git a/public/self.png b/src/assets/self.png similarity index 100% rename from public/self.png rename to src/assets/self.png diff --git a/src/components/Footer.astro b/src/components/Footer.astro new file mode 100644 index 0000000..c14c5a9 --- /dev/null +++ b/src/components/Footer.astro @@ -0,0 +1,16 @@ +--- +import "../styles/footer.scss"; +--- + + diff --git a/src/components/LeftNav.astro b/src/components/LeftNav.astro index 270befe..7ade6ab 100644 --- a/src/components/LeftNav.astro +++ b/src/components/LeftNav.astro @@ -1,19 +1,28 @@ --- import "../styles/leftNav.scss"; import { Content as ShortBio } from "../content/partials/shortBio.md"; +import links from "../data/links"; +import { Image } from "astro:assets"; +import portrait from "../assets/self.png"; ---