diff --git a/astro.config.mjs b/astro.config.mjs index 6f1c1a4..8d76827 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -4,6 +4,7 @@ import sitemap from "@astrojs/sitemap"; import Icons from 'unplugin-icons/vite' import mdx from '@astrojs/mdx'; import glsl from 'vite-plugin-glsl'; +import remarkToc from 'remark-toc' import svelte from "@astrojs/svelte"; import UnoCSS from 'unocss/astro' @@ -31,7 +32,11 @@ export default defineConfig({ ], }, integrations: [ - mdx(), + mdx({ + remarkPlugins: [ + remarkToc + ] + }), svelte(), UnoCSS({ injectReset: true diff --git a/package.json b/package.json index c487619..d34b307 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "astro": "^4.5.5", "astro-i18n-aut": "^0.7.0", "astro-imagetools": "^0.9.0", + "remark-toc": "^9.0.0", "svelte": "^4.2.12", "svelte-gestures": "^4.0.0", "tailwindcss": "^3.4.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f410e07..44b062b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -26,6 +26,9 @@ dependencies: astro-imagetools: specifier: ^0.9.0 version: 0.9.0(astro@4.5.5) + remark-toc: + specifier: ^9.0.0 + version: 9.0.0 svelte: specifier: ^4.2.12 version: 4.2.12 @@ -1909,6 +1912,10 @@ packages: '@types/node': 17.0.45 dev: true + /@types/ungap__structured-clone@0.3.3: + resolution: {integrity: sha512-RNmhIPwoip6K/zZOv3ypksTAqaqLEXvlNSXKyrC93xMSOAHZCR7PifW6xKZCwkbbnbM9dwB9X56PPoNTlNwEqw==} + dev: false + /@types/unist@2.0.10: resolution: {integrity: sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==} @@ -3988,6 +3995,18 @@ packages: dependencies: '@types/mdast': 4.0.3 + /mdast-util-toc@7.0.0: + resolution: {integrity: sha512-C28UcSqjmnWuvgT8d97qpaItHKvySqVPAECUzqQ51xuMyNFFJwcFoKW77KoMjtXrclTidLQFDzLUmTmrshRweA==} + dependencies: + '@types/mdast': 4.0.3 + '@types/ungap__structured-clone': 0.3.3 + '@ungap/structured-clone': 1.2.0 + github-slugger: 2.0.0 + mdast-util-to-string: 4.0.0 + unist-util-is: 6.0.0 + unist-util-visit: 5.0.0 + dev: false + /mdn-data@2.0.30: resolution: {integrity: sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==} @@ -5041,6 +5060,13 @@ packages: mdast-util-to-markdown: 2.1.0 unified: 11.0.4 + /remark-toc@9.0.0: + resolution: {integrity: sha512-KJ9txbo33GjDAV1baHFze7ij4G8c7SGYoY8Kzsm2gzFpbhL/bSoVpMMzGa3vrNDSWASNd/3ppAqL7cP2zD6JIA==} + dependencies: + '@types/mdast': 4.0.3 + mdast-util-toc: 7.0.0 + dev: false + /request-light@0.7.0: resolution: {integrity: sha512-lMbBMrDoxgsyO+yB3sDcrDuX85yYt7sS8BfQd11jtbW/z5ZWgLZRcEGLsLoYw7I0WSUGQBs8CC8ScIxkTX1+6Q==} dev: false diff --git a/public/app.css b/public/app.css index f2d5e65..34f6d53 100644 --- a/public/app.css +++ b/public/app.css @@ -20,7 +20,8 @@ article>h3 { } article>p>a, -article a { +article a, +.top-info>.links a { color: var(--fill) !important; } diff --git a/src/layouts/Post.astro b/src/layouts/Post.astro index 9b3da32..226656c 100644 --- a/src/layouts/Post.astro +++ b/src/layouts/Post.astro @@ -7,23 +7,38 @@ type CustomProps = { layout?: "normal" | "transparent"; backlink?: string; }; -type Props = CollectionEntry<"blog"> & CustomProps; +type Props = CollectionEntry<"blog" | "photos" | "videos" | "projects"> & + CustomProps; -const { headings, data } = Astro.props; -console.log(Astro.props); -const { title, date, links, _layout, backlink = "/blog" } = data; +const { data, backlink = "/" } = Astro.props; +const { title, date, links, _layout } = data; const path = useTranslatedPath(Astro.url); --- -
- + overview -
+ { + links?.length && ( + + ) + } + +
{ date.toLocaleString("en-US", { month: "long", @@ -34,51 +49,18 @@ const path = useTranslatedPath(Astro.url);