Convert blog posts page to Vento

This commit is contained in:
Leilukin 2025-05-04 20:30:07 +08:00
parent fbf8f5df73
commit 379e0d0854

View File

@ -3,29 +3,29 @@ title: Blog Archive
layout: main/content layout: main/content
tags: blog pages tags: blog pages
eleventyComputed: eleventyComputed:
desc: Archive of blog posts on {{ sitemeta.siteName | safe }} desc: Archive of blog posts on {{ sitemeta.siteName }}
eleventyNavigation: eleventyNavigation:
key: Blog Archive key: Blog Archive
parent: Blog parent: Blog
--- ---
<ul class="blog__postlist"> <ul class="blog__postlist">
{% for post in collections.posts | reverse %} {{ for post of collections.posts |> toReversed }}
<li class="blog__postlist--item"> <li class="blog__postlist--item">
<h2 class="blog__postlist--title"> <h2 class="blog__postlist--title">
<a href="{{ post.url }}"> <a href="{{ post.url }}">
{% if post.data.title %}{{ post.data.articleTitle }} {{ if post.data.title }}{{ post.data.articleTitle }}
{% else %} {{ else }}
<code>{{ post.url }}</code> <code>{{ post.url }}</code>
{% endif %} {{ /if }}
</a> </a>
</h2> </h2>
<time datetime="{{ post.date }}">{{ post.date | formatDate }}</time> <time datetime="{{ post.date }}">{{ post.date |> formatDate }}</time>
</li> </li>
{% endfor %} {{ /for }}
</ul> </ul>
{%- css %} {{- css }}
.blog__postlist { .blog__postlist {
display: grid; display: grid;
gap: 1em; gap: 1em;
@ -37,4 +37,4 @@ eleventyNavigation:
line-height: 1.3; line-height: 1.3;
margin-bottom: 0.2em; margin-bottom: 0.2em;
} }
{% endcss %} {{ /css }}