feat: add archive.html template

This commit is contained in:
st1020 2023-10-23 20:42:54 +08:00
parent 70876ae0d2
commit f9b448197c
4 changed files with 45 additions and 0 deletions

View file

@ -80,6 +80,10 @@ url = "/atom.xml"
name = "Projects"
url = "/projects"
[[extra.menu]]
name = "Archive"
url = "/archive"
[[extra.menu]]
name = "Tags"
url = "/tags"

7
content/pages/archive.md Normal file
View file

@ -0,0 +1,7 @@
+++
title = "Archive"
path = "archive"
template = "archive.html"
[extra]
section = "_index.md"
+++

View file

@ -1553,6 +1553,10 @@ body {
padding-left: 1rem;
}
.pl-6 {
padding-left: 1.5rem;
}
.pr-2 {
padding-right: 0.5rem;
}
@ -1569,6 +1573,10 @@ body {
text-align: center;
}
.font-mono {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.text-2xl {
font-size: 1.5rem;
line-height: 2rem;

26
templates/archive.html Normal file
View file

@ -0,0 +1,26 @@
{% extends "index.html" %}<!---->
{% block main %}<!---->
<h1 class="mb-16">{{ page.title }}</h1>
{% set section = get_section(path=page.extra.section) %}<!---->
{% for year, posts in section.pages | group_by(attribute="year") %}
<h2>{{ year }}</h2>
<div class="not-prose pl-6">
<ul>
{% for post in posts %}
<li>
<div class="my-2 flex items-center justify-between">
<a class="no-underline" href="{{ post.permalink }}">{{ post.title }}</a>
<time class="font-mono text-sm opacity-60">{{ post.date | date(format="%m-%d") }}</time>
</div>
</li>
{% endfor %}
</ul>
</div>
{% endfor %}<!---->
{% endblock main %}