Added a list of posts

This commit is contained in:
Eduard Urbach 2024-04-02 18:12:41 +02:00
parent f72ff5820d
commit 3d61843d1c
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
2 changed files with 11 additions and 12 deletions

9
App.go
View File

@ -1,6 +1,7 @@
package main package main
import ( import (
"bytes"
"fmt" "fmt"
"os" "os"
"strings" "strings"
@ -55,7 +56,13 @@ func (app *App) Run() {
} }
s.Get("/", func(ctx web.Context) error { s.Get("/", func(ctx web.Context) error {
return render(ctx, "<title>akyoto.dev</title>", markdown.Render("# Frontpage")) md := bytes.Buffer{}
for slug := range app.posts {
fmt.Fprintf(&md, "- [%s](/%s)\n", slug, slug)
}
return render(ctx, "<title>akyoto.dev</title>", markdown.Render(md.String()))
}) })
s.Get("/:post", func(ctx web.Context) error { s.Get("/:post", func(ctx web.Context) error {

View File

@ -8,7 +8,7 @@
--grey-color: hsl(0, 0%, 61%); --grey-color: hsl(0, 0%, 61%);
--highlight-color: hsla(0, 0%, 100%, 0.05); --highlight-color: hsla(0, 0%, 100%, 0.05);
--body-color: hsl(220, 5%, 12%); --body-color: hsl(220, 5%, 12%);
--font-family: system-ui, sans-serif; --font-family: "Segoe UI", system-ui;
--font-family-mono: monospace; --font-family-mono: monospace;
--font-size: 18px; --font-size: 18px;
--line-height: 1.6; --line-height: 1.6;
@ -139,8 +139,7 @@ th:empty {
} }
header, header,
main, main {
footer {
width: 100%; width: 100%;
max-width: var(--max-width); max-width: var(--max-width);
padding: var(--padding); padding: var(--padding);
@ -154,14 +153,6 @@ main {
flex: 1; flex: 1;
} }
footer {
display: flex;
flex-direction: column;
align-items: center;
font-size: 0.75em;
color: var(--grey-color);
}
nav { nav {
display: flex; display: flex;
gap: 1rem; gap: 1rem;
@ -188,6 +179,7 @@ time {
code { code {
font-family: var(--font-family-mono); font-family: var(--font-family-mono);
font-size: 80%;
word-break: break-word; word-break: break-word;
} }