Skip to content

Commit

Permalink
feat: rewrite templates using vento (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
uncenter authored Nov 19, 2024
1 parent 9cea73d commit ab4c01d
Show file tree
Hide file tree
Showing 26 changed files with 309 additions and 230 deletions.
11 changes: 7 additions & 4 deletions eleventy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -78,6 +80,7 @@ export default eleventy(function (eleventyConfig) {
},
],
});
eleventyConfig.addPlugin(VentoPlugin);

/* Passthrough Copy */
eleventyConfig.addPassthroughCopy({ 'public/': '.' });
Expand Down Expand Up @@ -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',
};
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
69 changes: 69 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 0 additions & 29 deletions src/_includes/postslist.njk

This file was deleted.

32 changes: 0 additions & 32 deletions src/_includes/projectslist.njk

This file was deleted.

6 changes: 0 additions & 6 deletions src/_layouts/page.njk

This file was deleted.

56 changes: 0 additions & 56 deletions src/_layouts/post.njk

This file was deleted.

33 changes: 33 additions & 0 deletions src/components/postslist.vto
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{ export function PostsList(posts) }}
{{- for index, post of posts -}}
<div class="{{ if index === 0 }}mt-0{{ else }}mx-0 my-8{{ /if }} no-underline">
<h2 class="font-semibold mx-0 my-0 text-xl leading-8" style="view-transition-name: post-{{ post.data.title |> slugify }}">
<a href="{{ post.url }}">{{ post.data.title }}</a>
</h2>
<div class="flex flex-row flex-wrap gap-2 lowercase my-2">
{{- if post.data.date -}}
<span>
{{ set date = post.data.date |> toShortDate }}
{{ set edited = post.data.edited |> toShortDate }}
<time datetime="{{ post.data.date }}">{{ date }}</time>
{{- if post.data.edited && (edited !== date) -}}
&nbsp;(last edited <time datetime="{{ post.data.edited }}">{{ edited }}</time>)
{{- /if -}}
</span>
{{- /if -}}
{{- if post.data.tags -}}
<span>&middot;</span>
<div class="flex flex-row flex-wrap space-x-1">
{{- for index, tag of post.data.tags -}}
<span>
<a href="/tags/{{ tag |> slugify }}">{{ tag }}</a>
{{- index != (post.data.tags.length - 1) ? ',' : '' -}}
</span>
{{- /for -}}
</div>
{{- /if -}}
</div>
<p class="mb-0 mt-1">{{ post.data.description }}</p>
</div>
{{- /for -}}
{{ /export }}
Loading

0 comments on commit ab4c01d

Please sign in to comment.