Updating UI for lists

This commit is contained in:
2026-04-03 21:27:47 +01:00
parent 11b9f68b02
commit 4832b812b2
3 changed files with 109 additions and 0 deletions

19
layouts/_default/li.html Normal file
View File

@@ -0,0 +1,19 @@
<li class="post-item">
{{ $format := "02 Jan 2006" }}
<a href="{{ .Permalink }}" class="post-item__link">
<span class="post-item__title">{{ .Title | markdownify }}</span>
<span class="post-item__date">{{ .Date.Format $format }}</span>
</a>
{{ if .Summary }}
<p class="post-item__summary">{{ .Summary | plainify | truncate 150 }}</p>
{{ end }}
{{ with .Params.tags }}
<div class="post-item__tags">
{{ range . }}
{{ with $.Site.GetPage (printf "/tags/%s" .) }}
<a href="{{ .Permalink }}" class="post-item__tag">{{ .Title }}</a>
{{ end }}
{{ end }}
</div>
{{ end }}
</li>

View File

@@ -0,0 +1,12 @@
{{ define "main" }}
<h1 id="{{ .Title | urlize }}">{{ .Title | markdownify }}</h1>
{{ .Content }}
<ul class="post-list">
{{ range .Pages.ByDate.Reverse }} {{ .Render "li" }} {{ end }}
</ul>
{{ end }} {{define "aside" }} {{ if .Params.description }}
<p>{{ .Params.description }}</p>
{{ end }} {{ end }}

78
static/css/custom.css Normal file
View File

@@ -0,0 +1,78 @@
.post-list {
list-style: none;
padding-left: 0;
display: flex;
flex-direction: column;
gap: 0;
}
.post-list .post-item {
padding: 1.5rem 0;
border-bottom: 1px solid var(--base02);
}
.post-list .post-item:first-child {
padding-top: 0;
}
.post-list .post-item::marker {
content: "";
}
.post-item__link {
display: flex;
justify-content: space-between;
align-items: baseline;
gap: 1.5rem;
text-decoration: none;
}
.post-item__title {
font-size: 1.15rem;
font-weight: 600;
color: var(--link);
}
.post-item__link:hover .post-item__title {
color: var(--hover);
}
.post-item__date {
font-size: 0.8rem;
color: var(--muted);
white-space: nowrap;
flex-shrink: 0;
}
.post-item__summary {
margin: 0.4rem 0 0 0;
font-size: 0.8rem;
line-height: 1.4;
color: var(--base04);
}
.post-item__tags {
display: flex;
flex-wrap: wrap;
gap: 0.4rem;
margin-top: 0.5rem;
}
.post-item__tag {
font-size: 0.7rem;
padding: 0.1rem 0.5rem;
background-color: var(--base02);
color: var(--base0E);
border-radius: 3px;
text-decoration: none;
}
.post-item__tag:link,
.post-item__tag:visited {
color: var(--base0E);
}
.post-item__tag:hover {
background-color: var(--base03);
color: var(--hover);
}