From 6422ee1980460cc316ca9ee1271f6dd9e799613e Mon Sep 17 00:00:00 2001 From: uncenter <47499684+uncenter@users.noreply.github.com> Date: Sun, 17 Nov 2024 23:37:11 -0500 Subject: [PATCH 1/3] feat: rewrite templates using vento --- eleventy.config.js | 8 +- package.json | 1 + pnpm-lock.yaml | 69 +++++++++++++++++ src/_includes/postslist.njk | 29 ------- src/_includes/projectslist.njk | 32 -------- src/_layouts/{base.njk => base.vto} | 75 +++++++++---------- src/_layouts/page.njk | 6 -- src/_layouts/page.vto | 6 ++ src/_layouts/{post.njk => post.vto} | 58 +++++++------- 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/posts/index.njk | 8 -- src/posts/index.vto | 9 +++ src/posts/posts.json | 2 +- src/projects.njk | 15 ---- src/projects.vto | 15 ++++ src/{tags.njk => tags.vto} | 7 +- src/{uses.njk => uses.vto} | 18 ++--- tailwind.config.js | 2 +- 23 files changed, 264 insertions(+), 184 deletions(-) delete mode 100644 src/_includes/postslist.njk delete mode 100644 src/_includes/projectslist.njk rename src/_layouts/{base.njk => base.vto} (70%) delete mode 100644 src/_layouts/page.njk create mode 100644 src/_layouts/page.vto rename src/_layouts/{post.njk => post.vto} (50%) 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} (54%) rename src/generated/{robots.txt.njk => robots.txt.vto} (60%) rename src/generated/{site.webmanifest.njk => site.webmanifest.vto} (100%) 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 rename src/{tags.njk => tags.vto} (57%) rename src/{uses.njk => uses.vto} (61%) diff --git a/eleventy.config.js b/eleventy.config.js index fad6dd13..7c838e04 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 { @@ -27,6 +29,8 @@ import site from './site.config.js'; import eleventy from '11ty.ts'; export default eleventy(function (eleventyConfig) { + eleventyConfig.addPlugin(VentoPlugin); + eleventyConfig.addGlobalData('site', site); eleventyConfig.addPlugin(shortcodes); eleventyConfig.addPlugin(collections); @@ -127,7 +131,7 @@ export default eleventy(function (eleventyConfig) { 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 c2f736be..ac93373e 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.27.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2f4c5d04..427eb1b1 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 @@ -243,6 +246,12 @@ packages: '@catppuccin/palette@1.4.0': resolution: {integrity: sha512-Npdg/QFeMAEbRVlnJqc1xE3i7NI4liSq4tTTXk4U/L3vPEiqw3bZQJRLYjuP0Vq2AEDNS5H5Li+lk27c38sP4g==} + '@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==} @@ -500,6 +509,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==} @@ -884,6 +896,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@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} @@ -955,6 +971,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'} @@ -1187,6 +1206,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'} @@ -1403,6 +1426,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.0: resolution: {integrity: sha512-KvOVV+X1yLBfs9dCBSopq/+G1PcgT3lAK07mC4BzXi5E7ahzMAF8oIupDDJ6mievI6F+lAATkbQQlQixJfT3aQ==} @@ -1994,6 +2021,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==} @@ -2011,6 +2041,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'} @@ -2232,6 +2267,13 @@ snapshots: '@catppuccin/palette@1.4.0': {} + '@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 @@ -2467,6 +2509,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 @@ -2832,6 +2876,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@8.0.0: {} emoji-regex@9.2.2: {} @@ -2878,6 +2929,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: {} @@ -3134,6 +3189,8 @@ snapshots: isexe@2.0.0: {} + isexe@3.1.1: {} + iso-639-1@3.1.3: {} jackspeak@3.4.3: @@ -3327,6 +3384,8 @@ snapshots: merge2@1.4.1: {} + meriyah@6.0.3: {} + micromark-util-character@2.1.0: dependencies: micromark-util-symbol: 2.0.0 @@ -3950,6 +4009,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 @@ -3971,6 +4036,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/base.njk b/src/_layouts/base.vto similarity index 70% rename from src/_layouts/base.njk rename to src/_layouts/base.vto index 61a02f99..f7f68425 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.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/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.njk b/src/_layouts/post.vto similarity index 50% rename from src/_layouts/post.njk rename to src/_layouts/post.vto index 44a0d03d..8aec418a 100644 --- a/src/_layouts/post.njk +++ b/src/_layouts/post.vto @@ -1,56 +1,56 @@ --- -layout: base.njk +layout: base.vto ---
-

{{ title }}

+

{{ title }}

- {% if date %} + {{ if date }} - {% if edited and ((edited | toShortDate) != (date | toShortDate)) %} -  (last edited ) - {% endif %} + {{ if edited && ((edited |> toShortDate) !== (date |> toShortDate)) }} +  (last edited ) + {{ /if }} - {% endif %} - {% if tags %} + {{ /if }} + {{ if tags }} ·
- {%- for tag in tags -%} + {{- for tag of tags -}} - {{ tag }} - {%- if not loop.last -%},{% endif -%} + {{ tag }} + {{- if !loop.last -}},{{ /if -}} - {%- endfor -%} + {{- /for -}}
- {% endif %} + {{ /if }}
- {% if content | toc %} + {{ if content |> toc }} - {% endif %} - {{ content | safe }} + {{ /if }} + {{ content |> safe }}
-{% if comments %} +{{ if comments }}
-{% endif %} -{% set previous = collections.posts | getPreviousCollectionItem %} -{% set next = collections.posts | getNextCollectionItem %} +{{ /if }} +{{ set previous = collections.posts |> getPreviousCollectionItem }} +{{ set next = collections.posts |> getNextCollectionItem }}
- {% if previous %} + {{ if previous }} - {%- icon 'lucide:arrow-left' -%} + {{- icon 'lucide:arrow-left' -}} {{ previous.data.title }} - {% endif %} - {% if not previous and next %} + {{ /if }} + {{ if !previous && next }}
- {% endif %} - {% if next %} + {{ /if }} + {{ if next }} {{ next.data.title }} - {%- icon 'lucide:arrow-right' -%} + {{- icon 'lucide:arrow-right' -}} - {% endif %} + {{ /if }}
diff --git a/src/components/postslist.vto b/src/components/postslist.vto new file mode 100644 index 00000000..2c15ff81 --- /dev/null +++ b/src/components/postslist.vto @@ -0,0 +1,33 @@ +{{ export function listPosts(posts) }} + {{- for 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 tag of post.data.tags -}} + + {{ tag }} + {{- if !loop.last -}},{{ /if -}} + + {{- /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..c4171eee --- /dev/null +++ b/src/components/projectslist.vto @@ -0,0 +1,34 @@ +{{ export function listProjects(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 54% rename from src/generated/feed.xml.njk rename to src/generated/feed.xml.vto index 50ee9c89..2718a47c 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 |> htmlToAbsoluteUrls(url) }} - {%- 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/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..f07bc377 --- /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 { listPosts } from "postslist.vto" }} + +{{ listPosts(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/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..3b8503b8 --- /dev/null +++ b/src/projects.vto @@ -0,0 +1,15 @@ +--- +layout: page +title: Projects +description: A list of projects I've worked on. +--- + +{{ import { listProjects } from "./components/projectslist.vto" }} + +{{ listProjects(projects.current) }} + +
+ +

Catppuccin

+ +{{ listProjects(projects.catppuccin) }} diff --git a/src/tags.njk b/src/tags.vto similarity index 57% rename from src/tags.njk rename to src/tags.vto index 902aa76c..78a28763 100644 --- a/src/tags.njk +++ b/src/tags.vto @@ -11,9 +11,10 @@ permalink: /tags/{{ tag | slugify }}/ description: Posts tagged “{{ tag }}” --- -{% set postslist = collections[tag] | reverse %} -{% include "postslist.njk" %} +{{ import { listPosts } from "postslist.vto" }} + +{{ listPosts(collections[tag].toReversed()) }}

- {%- icon 'lucide:arrow-left' -%}All posts + {{ 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', From e6b62d345f6006cb28f359b313b5452eda2aaa9a Mon Sep 17 00:00:00 2001 From: uncenter <47499684+uncenter@users.noreply.github.com> Date: Tue, 19 Nov 2024 00:42:58 -0500 Subject: [PATCH 2/3] fix: remaining syntax errors, minor restructuring --- eleventy.config.js | 7 +++--- src/components/postslist.vto | 40 +++++++++++++++--------------- src/components/projectslist.vto | 2 +- src/generated/feed.xml.vto | 2 +- src/{_layouts => layouts}/base.vto | 6 ++--- src/{_layouts => layouts}/page.vto | 0 src/{_layouts => layouts}/post.vto | 40 +++++++++++++++--------------- src/posts/index.vto | 4 +-- src/privacy.md | 2 +- src/projects.vto | 6 ++--- src/tags.vto | 6 ++--- 11 files changed, 57 insertions(+), 58 deletions(-) rename src/{_layouts => layouts}/base.vto (96%) rename src/{_layouts => layouts}/page.vto (100%) rename src/{_layouts => layouts}/post.vto (57%) diff --git a/eleventy.config.js b/eleventy.config.js index 7c838e04..8ca2bb4c 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -29,8 +29,6 @@ import site from './site.config.js'; import eleventy from '11ty.ts'; export default eleventy(function (eleventyConfig) { - eleventyConfig.addPlugin(VentoPlugin); - eleventyConfig.addGlobalData('site', site); eleventyConfig.addPlugin(shortcodes); eleventyConfig.addPlugin(collections); @@ -82,6 +80,7 @@ export default eleventy(function (eleventyConfig) { }, ], }); + eleventyConfig.addPlugin(VentoPlugin); /* Passthrough Copy */ eleventyConfig.addPassthroughCopy({ 'public/': '.' }); @@ -127,8 +126,8 @@ export default eleventy(function (eleventyConfig) { dir: { input: 'src', output: 'dist', - includes: '_includes', - layouts: '_layouts', + includes: 'components', + layouts: 'layouts', data: '_data', }, templateFormats: ['md', 'vto', '11ty.js'], diff --git a/src/components/postslist.vto b/src/components/postslist.vto index 2c15ff81..e44c401c 100644 --- a/src/components/postslist.vto +++ b/src/components/postslist.vto @@ -1,30 +1,30 @@ -{{ export function listPosts(posts) }} - {{- for post of posts -}} -
+{{ 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 tag of post.data.tags -}} - {{ tag }} - {{- if !loop.last -}},{{ /if -}} + {{ set date = post.data.date |> toShortDate }} + {{ set edited = post.data.edited |> toShortDate }} + + {{- if post.data.edited && (edited !== date) -}} +  (last edited ) + {{- /if -}} - {{- /for -}} -
+ {{- /if -}} + {{- if post.data.tags -}} + · +
+ {{- for index, tag of post.data.tags -}} + + {{ tag }} + {{- index != (post.data.tags.length - 1) ? ',' : '' -}} + + {{- /for -}} +
{{- /if -}}

{{ post.data.description }}

diff --git a/src/components/projectslist.vto b/src/components/projectslist.vto index c4171eee..2431034b 100644 --- a/src/components/projectslist.vto +++ b/src/components/projectslist.vto @@ -1,4 +1,4 @@ -{{ export function listProjects(projects) }} +{{ export async function ProjectsList(projects) }}
- {{ for item of footerLinks }} - {{ item.title }}{{ if !loop.last }} · {{ /if }} + {{ for index, item of footerLinks }} + {{ item.title }}{{ if index != (footerLinks.length - 1) }} · {{ /if }} {{ /for }}