From ab4c01dc98aceb70ab5ccba41620d3ae436e8982 Mon Sep 17 00:00:00 2001 From: uncenter <47499684+uncenter@users.noreply.github.com> Date: Tue, 19 Nov 2024 00:55:34 -0500 Subject: [PATCH] feat: rewrite templates using vento (#232) --- eleventy.config.js | 11 ++- package.json | 1 + pnpm-lock.yaml | 69 +++++++++++++++++ src/_includes/postslist.njk | 29 ------- src/_includes/projectslist.njk | 32 -------- src/_layouts/page.njk | 6 -- src/_layouts/post.njk | 56 -------------- src/components/postslist.vto | 33 ++++++++ src/components/projectslist.vto | 34 +++++++++ src/generated/{404.njk => 404.vto} | 2 +- src/generated/{feed.xml.njk => feed.xml.vto} | 17 +++-- .../{robots.txt.njk => robots.txt.vto} | 2 +- ...e.webmanifest.njk => site.webmanifest.vto} | 0 src/{_layouts/base.njk => layouts/base.vto} | 75 +++++++++---------- src/layouts/page.vto | 6 ++ src/layouts/post.vto | 56 ++++++++++++++ src/posts/index.njk | 8 -- src/posts/index.vto | 9 +++ src/posts/posts.json | 2 +- src/privacy.md | 2 +- src/projects.njk | 15 ---- src/projects.vto | 15 ++++ src/tags.njk | 19 ----- src/tags.vto | 20 +++++ src/{uses.njk => uses.vto} | 18 ++--- tailwind.config.js | 2 +- 26 files changed, 309 insertions(+), 230 deletions(-) delete mode 100644 src/_includes/postslist.njk delete mode 100644 src/_includes/projectslist.njk delete mode 100644 src/_layouts/page.njk delete mode 100644 src/_layouts/post.njk create mode 100644 src/components/postslist.vto create mode 100644 src/components/projectslist.vto rename src/generated/{404.njk => 404.vto} (90%) rename src/generated/{feed.xml.njk => feed.xml.vto} (53%) rename src/generated/{robots.txt.njk => robots.txt.vto} (60%) rename src/generated/{site.webmanifest.njk => site.webmanifest.vto} (100%) rename src/{_layouts/base.njk => layouts/base.vto} (70%) create mode 100644 src/layouts/page.vto create mode 100644 src/layouts/post.vto delete mode 100644 src/posts/index.njk create mode 100644 src/posts/index.vto delete mode 100644 src/projects.njk create mode 100644 src/projects.vto delete mode 100644 src/tags.njk create mode 100644 src/tags.vto rename src/{uses.njk => uses.vto} (61%) diff --git a/eleventy.config.js b/eleventy.config.js index fad6dd13..8ca2bb4c 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -7,6 +7,8 @@ import pluginAutoCacheBuster from 'eleventy-auto-cache-buster'; import pluginIcons from 'eleventy-plugin-icons'; import pluginValidate from 'eleventy-plugin-validate'; +import { VentoPlugin } from 'eleventy-plugin-vento'; + import markdownLibrary from './config/markdown/core.js'; import { @@ -78,6 +80,7 @@ export default eleventy(function (eleventyConfig) { }, ], }); + eleventyConfig.addPlugin(VentoPlugin); /* Passthrough Copy */ eleventyConfig.addPassthroughCopy({ 'public/': '.' }); @@ -123,11 +126,11 @@ export default eleventy(function (eleventyConfig) { dir: { input: 'src', output: 'dist', - includes: '_includes', - layouts: '_layouts', + includes: 'components', + layouts: 'layouts', data: '_data', }, - templateFormats: ['md', 'njk', '11ty.js'], - markdownTemplateEngine: 'njk', + templateFormats: ['md', 'vto', '11ty.js'], + markdownTemplateEngine: 'vto', }; }); diff --git a/package.json b/package.json index 66a113b6..ca595234 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "eleventy-auto-cache-buster": "^0.6.1", "eleventy-plugin-icons": "^4.5.1", "eleventy-plugin-validate": "^0.1.3", + "eleventy-plugin-vento": "^4.0.1", "html-minifier": "^4.0.0", "image-size": "^1.1.1", "lightningcss": "^1.28.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 144fbe58..ea918272 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -53,6 +53,9 @@ importers: eleventy-plugin-validate: specifier: ^0.1.3 version: 0.1.3 + eleventy-plugin-vento: + specifier: ^4.0.1 + version: 4.0.1 html-minifier: specifier: ^4.0.0 version: 4.0.0 @@ -247,6 +250,12 @@ packages: '@catppuccin/palette@1.7.1': resolution: {integrity: sha512-aRc1tbzrevOTV7nFTT9SRdF26w/MIwT4Jwt4fDMc9itRZUDXCuEDBLyz4TQMlqO9ZP8mf5Hu4Jr6D03NLFc6Gw==} + '@deno/shim-deno-test@0.5.0': + resolution: {integrity: sha512-4nMhecpGlPi0cSzT67L+Tm+GOJqvuk8gqHBziqcUQOarnuIax1z96/gJHCSIz2Z0zhxE6Rzwb3IZXPtFh51j+w==} + + '@deno/shim-deno@0.18.2': + resolution: {integrity: sha512-oQ0CVmOio63wlhwQF75zA4ioolPvOwAoK0yuzcS5bDC1JUvH3y1GS8xPh8EOpcoDQRU4FTG8OQfxhpR+c6DrzA==} + '@emnapi/runtime@1.3.0': resolution: {integrity: sha512-XMBySMuNZs3DM96xcJmLW4EfGnf+uGmFNjzpehMjuX5PLB5j87ar2Zc4e3PVeZ3I5g3tYtAqskB28manlF69Zw==} @@ -517,6 +526,9 @@ packages: resolution: {integrity: sha512-doH1gimEu3A46VX6aVxpHTeHrytJAG6HgdxntYnCFiIFHEM/ZGpG8KiZGBChchjQmG0XFIBL552kBTjVcMZXwQ==} engines: {node: '>=12'} + '@types/estree@1.0.6': + resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} + '@types/hast@3.0.4': resolution: {integrity: sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==} @@ -910,6 +922,10 @@ packages: eleventy-plugin-validate@0.1.3: resolution: {integrity: sha512-UGzW91YbEeWwGRUy0njDbCTNKuNl8DVmgxGhbyqbDPisSZcqDRtc8Gq5hcURRihvi2t6eD+gZi8G87h4qDSNpg==} + eleventy-plugin-vento@4.0.1: + resolution: {integrity: sha512-gD7Udj/0uE2tiSQUech5mwVTfeD9T2AmVAIuhxtd7hOgN2/MRsptdJHcdanYZLAEd8VmJff3q949sPKPVYZnJQ==} + engines: {node: '>=18'} + emoji-regex-xs@1.0.0: resolution: {integrity: sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg==} @@ -984,6 +1000,9 @@ packages: estree-is-member-expression@1.0.0: resolution: {integrity: sha512-Ec+X44CapIGExvSZN+pGkmr5p7HwUVQoPQSd458Lqwvaf4/61k/invHSh4BYK8OXnCkfEhWuIoG5hayKLQStIg==} + estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + etag@1.8.1: resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} engines: {node: '>= 0.6'} @@ -1225,6 +1244,10 @@ packages: isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + isexe@3.1.1: + resolution: {integrity: sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==} + engines: {node: '>=16'} + iso-639-1@3.1.3: resolution: {integrity: sha512-1jz0Wh9hyLMRwqEPchb/KZCiTqfFWtc9R3nm7GHPygBAKS8wdKJ3FH4lvLsri6UtAE5Kz5SnowtXZa//6bqMyw==} engines: {node: '>=6.0'} @@ -1444,6 +1467,10 @@ packages: resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} engines: {node: '>= 8'} + meriyah@6.0.3: + resolution: {integrity: sha512-NqUbuQIjIH8dxUBPTMHS1kwIHd6n6nF3F7oeLXGWqBkpVP2lZxVHdab5JxbFBisIB4axZ9b/lT4HLJfZxmFK7Q==} + engines: {node: '>=18.0.0'} + micromark-util-character@2.1.1: resolution: {integrity: sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==} @@ -2041,6 +2068,9 @@ packages: util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + ventojs@1.12.11: + resolution: {integrity: sha512-76lCfS0/7dFV40fCTz5tTcruCoSCl+preV2upitB2pvh6ntGS5VikCQ4YPgqR+/BfVDxZRF4IQGJ2hmDWF6KhA==} + vfile-message@4.0.2: resolution: {integrity: sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==} @@ -2058,6 +2088,11 @@ packages: engines: {node: '>= 8'} hasBin: true + which@4.0.0: + resolution: {integrity: sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==} + engines: {node: ^16.13.0 || >=18.0.0} + hasBin: true + wrap-ansi@7.0.0: resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} engines: {node: '>=10'} @@ -2289,6 +2324,13 @@ snapshots: '@catppuccin/palette@1.7.1': {} + '@deno/shim-deno-test@0.5.0': {} + + '@deno/shim-deno@0.18.2': + dependencies: + '@deno/shim-deno-test': 0.5.0 + which: 4.0.0 + '@emnapi/runtime@1.3.0': dependencies: tslib: 2.7.0 @@ -2535,6 +2577,8 @@ snapshots: dependencies: escape-string-regexp: 5.0.0 + '@types/estree@1.0.6': {} + '@types/hast@3.0.4': dependencies: '@types/unist': 3.0.3 @@ -2912,6 +2956,13 @@ snapshots: kleur: 4.1.5 zod: 3.23.8 + eleventy-plugin-vento@4.0.1: + dependencies: + debug: 4.3.7 + ventojs: 1.12.11 + transitivePeerDependencies: + - supports-color + emoji-regex-xs@1.0.0: {} emoji-regex@8.0.0: {} @@ -2960,6 +3011,10 @@ snapshots: estree-is-member-expression@1.0.0: {} + estree-walker@3.0.3: + dependencies: + '@types/estree': 1.0.6 + etag@1.8.1: {} evaluate-value@2.0.0: {} @@ -3226,6 +3281,8 @@ snapshots: isexe@2.0.0: {} + isexe@3.1.1: {} + iso-639-1@3.1.3: {} jackspeak@3.4.3: @@ -3423,6 +3480,8 @@ snapshots: merge2@1.4.1: {} + meriyah@6.0.3: {} + micromark-util-character@2.1.1: dependencies: micromark-util-symbol: 2.0.1 @@ -4056,6 +4115,12 @@ snapshots: util-deprecate@1.0.2: {} + ventojs@1.12.11: + dependencies: + '@deno/shim-deno': 0.18.2 + estree-walker: 3.0.3 + meriyah: 6.0.3 + vfile-message@4.0.2: dependencies: '@types/unist': 3.0.3 @@ -4077,6 +4142,10 @@ snapshots: dependencies: isexe: 2.0.0 + which@4.0.0: + dependencies: + isexe: 3.1.1 + wrap-ansi@7.0.0: dependencies: ansi-styles: 4.3.0 diff --git a/src/_includes/postslist.njk b/src/_includes/postslist.njk deleted file mode 100644 index 3348096b..00000000 --- a/src/_includes/postslist.njk +++ /dev/null @@ -1,29 +0,0 @@ -{%- for post in postslist -%} -
-

- {{ post.data.title }} -

-
- {%- if post.data.date -%} - - - {%- if post.data.edited and ((post.data.edited | toShortDate) != (post.data.date | toShortDate)) -%} -  (last edited ) - {%- endif -%} - - {%- endif -%} - {%- if post.data.tags -%} - · -
- {%- for tag in post.data.tags -%} - - {{ tag }} - {%- if not loop.last -%},{% endif -%} - - {%- endfor -%} -
- {%- endif -%} -
-

{{ post.data.description }}

-
-{%- endfor -%} diff --git a/src/_includes/projectslist.njk b/src/_includes/projectslist.njk deleted file mode 100644 index 67d70dd7..00000000 --- a/src/_includes/projectslist.njk +++ /dev/null @@ -1,32 +0,0 @@ -
- {%- for project in projectslist -%} - -
-

{{ project.name }}

-

{{ project.description }}

-
-
-
- {% for item in project.stack %} - {%- icon "si:" + item, class='block w-5 h-5 text-text align-baseline' -%} - {% endfor %} -
-
-
{%- icon "si:github", class='block w-5 h-5 text-text align-baseline' -%}
- {% if project.live and not project.live.startsWith("https://crates.io") %} - {%- if project.live.startsWith("https://discord.gg") -%} - {%- set liveIcon = 'si:discord' -%} - {%- elif project.live.startsWith("https://npmjs.com") or project.live.startsWith("https://www.npmjs.com") -%} - {%- set liveIcon = 'si:npm' -%} - {% elif project.live.startsWith("https://chrome.google.com/webstore") or project.live.startsWith("https://chromewebstore.google.com") %} - {%- set liveIcon = 'si:chromewebstore' -%} - {%- else -%} - {%- set liveIcon = 'lucide:globe' -%} - {%- endif -%} -
{%- icon liveIcon, class='block w-5 h-5 text-text align-baseline' -%}
- {% endif %} -
-
-
- {% endfor %} -
diff --git a/src/_layouts/page.njk b/src/_layouts/page.njk deleted file mode 100644 index 8fa82fbe..00000000 --- a/src/_layouts/page.njk +++ /dev/null @@ -1,6 +0,0 @@ ---- -layout: base.njk ---- - -

{{ header or title }}

-{{ content | safe }} diff --git a/src/_layouts/post.njk b/src/_layouts/post.njk deleted file mode 100644 index 44a0d03d..00000000 --- a/src/_layouts/post.njk +++ /dev/null @@ -1,56 +0,0 @@ ---- -layout: base.njk ---- - -
-

{{ title }}

-
- {% if date %} - - - {% if edited and ((edited | toShortDate) != (date | toShortDate)) %} -  (last edited ) - {% endif %} - - {% endif %} - {% if tags %} - · -
- {%- for tag in tags -%} - - {{ tag }} - {%- if not loop.last -%},{% endif -%} - - {%- endfor -%} -
- {% endif %} -
- {% if content | toc %} - - {% endif %} - {{ content | safe }} -
-{% if comments %} -
-{% endif %} -{% set previous = collections.posts | getPreviousCollectionItem %} -{% set next = collections.posts | getNextCollectionItem %} -
- {% if previous %} - - {%- icon 'lucide:arrow-left' -%} - {{ previous.data.title }} - - {% endif %} - {% if not previous and next %} -
- {% endif %} - {% if next %} - - {{ next.data.title }} - {%- icon 'lucide:arrow-right' -%} - - {% endif %} -
diff --git a/src/components/postslist.vto b/src/components/postslist.vto new file mode 100644 index 00000000..e44c401c --- /dev/null +++ b/src/components/postslist.vto @@ -0,0 +1,33 @@ +{{ export function PostsList(posts) }} + {{- for index, post of posts -}} +
+

+ {{ post.data.title }} +

+
+ {{- if post.data.date -}} + + {{ set date = post.data.date |> toShortDate }} + {{ set edited = post.data.edited |> toShortDate }} + + {{- if post.data.edited && (edited !== date) -}} +  (last edited ) + {{- /if -}} + + {{- /if -}} + {{- if post.data.tags -}} + · +
+ {{- for index, tag of post.data.tags -}} + + {{ tag }} + {{- index != (post.data.tags.length - 1) ? ',' : '' -}} + + {{- /for -}} +
+ {{- /if -}} +
+

{{ post.data.description }}

+
+ {{- /for -}} +{{ /export }} diff --git a/src/components/projectslist.vto b/src/components/projectslist.vto new file mode 100644 index 00000000..2431034b --- /dev/null +++ b/src/components/projectslist.vto @@ -0,0 +1,34 @@ +{{ export async function ProjectsList(projects) }} +
+ {{- for project of projects -}} + +
+

{{ project.name }}

+

{{ project.description }}

+
+
+
+ {{ for item of project.stack }} + {{- icon "si:" + item, { class: 'block w-5 h-5 text-text align-baseline' } -}} + {{ /for }} +
+
+
{{- icon "si:github", { class: 'block w-5 h-5 text-text align-baseline' } -}}
+ {{ if project.live && !project.live.startsWith("https://crates.io") }} + {{- if project.live.startsWith("https://discord.gg") -}} + {{- set liveIcon = 'si:discord' -}} + {{- else if project.live.startsWith("https://npmjs.com") || project.live.startsWith("https://www.npmjs.com") -}} + {{- set liveIcon = 'si:npm' -}} + {{ else if project.live.startsWith("https://chrome.google.com/webstore") || project.live.startsWith("https://chromewebstore.google.com") }} + {{- set liveIcon = 'si:chromewebstore' -}} + {{- else -}} + {{- set liveIcon = 'lucide:globe' -}} + {{- /if -}} +
{{- icon liveIcon, { class: 'block w-5 h-5 text-text align-baseline' } -}}
+ {{ /if }} +
+
+
+ {{ /for }} +
+{{ /export }} diff --git a/src/generated/404.njk b/src/generated/404.vto similarity index 90% rename from src/generated/404.njk rename to src/generated/404.vto index 72fa2476..0ecfa008 100644 --- a/src/generated/404.njk +++ b/src/generated/404.vto @@ -2,7 +2,7 @@ title: Page Not Found permalink: /404.html description: Uh oh.. Couldn't find that page. -layout: page.njk +layout: page.vto ---

Uh oh.. Couldn't find that page.

diff --git a/src/generated/feed.xml.njk b/src/generated/feed.xml.vto similarity index 53% rename from src/generated/feed.xml.njk rename to src/generated/feed.xml.vto index 50ee9c89..6636540f 100644 --- a/src/generated/feed.xml.njk +++ b/src/generated/feed.xml.vto @@ -5,20 +5,21 @@ eleventyExcludeFromCollections: false {{ site.domain }} {{ site.feed.description }} - + - {{ collections.posts | getNewestCollectionItemDate | dateToRfc3339 }} + {{ collections.posts |> getNewestCollectionItemDate |> dateToRfc3339 }} {{ site.url }} {{ site.author.name }} - {%- for post in collections.posts | reverse %} + {{- for post of collections.posts.toReversed() }} + {{- set url = post.url |> url }} {{ post.data.title }} - - {{ post.date | dateToRfc3339 }} - {{ post.url | url }} - {{ post.content | htmlToAbsoluteUrls(post.url | url) }} + + {{ post.date |> dateToRfc3339 }} + {{ url }} + {{ post.content |> await htmlToAbsoluteUrls(url) |> escape }} - {%- endfor %} + {{ /for }} diff --git a/src/generated/robots.txt.njk b/src/generated/robots.txt.vto similarity index 60% rename from src/generated/robots.txt.njk rename to src/generated/robots.txt.vto index 25e144c1..7f117b74 100644 --- a/src/generated/robots.txt.njk +++ b/src/generated/robots.txt.vto @@ -1,7 +1,7 @@ --- permalink: /robots.txt --- -Sitemap: {{ '/sitemap.xml' | url }} +Sitemap: {{ '/sitemap.xml' |> url }} User-agent: * Disallow: diff --git a/src/generated/site.webmanifest.njk b/src/generated/site.webmanifest.vto similarity index 100% rename from src/generated/site.webmanifest.njk rename to src/generated/site.webmanifest.vto diff --git a/src/_layouts/base.njk b/src/layouts/base.vto similarity index 70% rename from src/_layouts/base.njk rename to src/layouts/base.vto index 61a02f99..3e9bfdb5 100644 --- a/src/_layouts/base.njk +++ b/src/layouts/base.vto @@ -17,11 +17,8 @@ footerLinks: url: /sitemap.xml --- -{% if title %} - {% set title = title + " - " + site.domain %} -{% else %} - {% set title = site.domain %} -{%- endif -%} +{{ set title = title ? (title + " - " + site.domain) : site.domain }} +{{ set description = description ? description : site.description }} @@ -31,20 +28,20 @@ footerLinks: {{ title }} - + - + @@ -58,31 +55,31 @@ footerLinks: - - - + + + - {% if layout != 'post.njk' %} + {{ if layout !== 'post.vto' }} - {% else %} + {{ else }} - {% for keyword in tags %} - - {% endfor %} - {% endif %} + {{ for keyword of tags }} + + {{ /for }} + {{ /if }} - - + + - +
- +
- {{ content | safe }} + {{ content |> safe }}
diff --git a/src/layouts/page.vto b/src/layouts/page.vto new file mode 100644 index 00000000..65daa4ab --- /dev/null +++ b/src/layouts/page.vto @@ -0,0 +1,6 @@ +--- +layout: base.vto +--- + +

{{ header || title }}

+{{ content |> safe }} diff --git a/src/layouts/post.vto b/src/layouts/post.vto new file mode 100644 index 00000000..fb5bfc51 --- /dev/null +++ b/src/layouts/post.vto @@ -0,0 +1,56 @@ +--- +layout: base.vto +--- + +
+

{{ title }}

+
+ {{ if date }} + + {{ set shortenedDate = date |> toShortDate }} + + {{ set shortenedEdited = edited |> toShortDate }} + {{ if edited && (shortenedEdited !== shortenedDate) }} +  (last edited ) + {{ /if }} + + {{ /if }} + {{ if tags }} + · +
+ {{- for index, tag of tags -}} + + {{ tag }} + {{- if index != (tags.length - 1) -}},{{ /if -}} + + {{- /for -}} +
+ {{ /if }} +
+ + {{ content |> safe }} +
+{{ if comments }} +
+{{ /if }} +{{ set previous = collections.posts |> getPreviousCollectionItem }} +{{ set next = collections.posts |> getNextCollectionItem }} +
+ {{ if previous }} + + {{- icon 'lucide:arrow-left' -}} + {{ previous.data.title }} + + {{ /if }} + {{ if !previous && next }} +
+ {{ /if }} + {{ if next }} + + {{ next.data.title }} + {{- icon 'lucide:arrow-right' -}} + + {{ /if }} +
diff --git a/src/posts/index.njk b/src/posts/index.njk deleted file mode 100644 index 28881354..00000000 --- a/src/posts/index.njk +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: Articles -layout: page.njk -description: Articles about programming, linguistics, and other things. ---- - -{% set postslist = collections.posts | reverse %} -{% include "postslist.njk" %} diff --git a/src/posts/index.vto b/src/posts/index.vto new file mode 100644 index 00000000..a91e5b3a --- /dev/null +++ b/src/posts/index.vto @@ -0,0 +1,9 @@ +--- +title: Articles +layout: page.vto +description: Articles about programming, linguistics, and other things. +--- + +{{ import { PostsList } from "../components/postslist.vto" }} + +{{ PostsList(collections.posts.toReversed()) }} diff --git a/src/posts/posts.json b/src/posts/posts.json index ab1d1670..65b461f1 100644 --- a/src/posts/posts.json +++ b/src/posts/posts.json @@ -1,3 +1,3 @@ { - "layout": "post.njk" + "layout": "post.vto" } diff --git a/src/privacy.md b/src/privacy.md index 2c5934d4..d567b7b1 100644 --- a/src/privacy.md +++ b/src/privacy.md @@ -14,7 +14,7 @@ The analytics data [is publicly available for anyone to view]({{ analytics.share ### Source code -The website's [source code]({{ site.repository | url('https://github.com/')}}) is available under the MIT License. +The website's [source code]({{ site.repository |> url('https://github.com/')}}) is available under the MIT License. ### Content diff --git a/src/projects.njk b/src/projects.njk deleted file mode 100644 index 3ce19a2c..00000000 --- a/src/projects.njk +++ /dev/null @@ -1,15 +0,0 @@ ---- -layout: page -title: Projects -description: A list of projects I've worked on. ---- - -{% set projectslist = projects.current %} -{% include "projectslist.njk" %} - -
- -

Catppuccin

- -{% set projectslist = projects.catppuccin %} -{% include "projectslist.njk" %} diff --git a/src/projects.vto b/src/projects.vto new file mode 100644 index 00000000..3316634a --- /dev/null +++ b/src/projects.vto @@ -0,0 +1,15 @@ +--- +layout: page +title: Projects +description: A list of projects I've worked on. +--- + +{{ import { ProjectsList } from "./components/projectslist.vto" }} + +{{ await ProjectsList(projects.current) }} + +
+ +

Catppuccin

+ +{{ await ProjectsList(projects.catppuccin) }} diff --git a/src/tags.njk b/src/tags.njk deleted file mode 100644 index 902aa76c..00000000 --- a/src/tags.njk +++ /dev/null @@ -1,19 +0,0 @@ ---- -layout: page -eleventyExcludeFromCollections: true -pagination: - data: collections - size: 1 - alias: tag -eleventyComputed: - title: Tagged “{{ tag }}” -permalink: /tags/{{ tag | slugify }}/ -description: Posts tagged “{{ tag }}” ---- - -{% set postslist = collections[tag] | reverse %} -{% include "postslist.njk" %} - -

- {%- icon 'lucide:arrow-left' -%}All posts -

diff --git a/src/tags.vto b/src/tags.vto new file mode 100644 index 00000000..60c635ad --- /dev/null +++ b/src/tags.vto @@ -0,0 +1,20 @@ +--- +layout: page +eleventyExcludeFromCollections: true +pagination: + data: collections + size: 1 + alias: tag +eleventyComputed: + title: Tagged “{{ tag }}” +permalink: /tags/{{ tag |> slugify }}/ +description: Posts tagged “{{ tag }}” +--- + +{{ import { PostsList } from "./components/postslist.vto" }} + +{{ PostsList(collections[tag].toReversed()) }} + +

+ {{ icon 'lucide:arrow-left' }}All posts +

diff --git a/src/uses.njk b/src/uses.vto similarity index 61% rename from src/uses.njk rename to src/uses.vto index 6c9560b1..050cf602 100644 --- a/src/uses.njk +++ b/src/uses.vto @@ -5,18 +5,18 @@ description: All sorts of things that I use. ---

All the things I use! To see other /uses pages, check out uses.tech.

-{% for category, subcategories in uses %} +{{ for category, subcategories of uses }}

{{ category }}

- {% for heading, items in subcategories %} - {% if items.length > 0 %} + {{ for heading, items of subcategories }} + {{ if items.length > 0 }}

{{ heading }}

- {% endif %} - {% endfor %} -{% endfor%} + {{ /if }} + {{ /for }} +{{ /for }} diff --git a/tailwind.config.js b/tailwind.config.js index bef23f51..97b2dbd1 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -3,7 +3,7 @@ const { flavors } = require('@catppuccin/palette'); /** @type {import('tailwindcss').Config} */ export default { - content: ['./src/**/*.{11ty.js,js,md,njk}'], + content: ['./src/**/*.{11ty.js,js,md,vto}'], theme: { fontSize: { xs: '0.875rem',