Passt so
This commit is contained in:
20
internal/web/templates/article.html
Normal file
20
internal/web/templates/article.html
Normal file
@@ -0,0 +1,20 @@
|
||||
{{ define "article" }}
|
||||
{{ template "base.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "title" }}{{ .Title }} – B1tsblog{{ end }}
|
||||
|
||||
{{ define "body" }}
|
||||
<article class="article">
|
||||
<header>
|
||||
<h1>{{ .Title }}</h1>
|
||||
<time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "02.01.2006" }}</time>
|
||||
</header>
|
||||
|
||||
<div class="article-content">
|
||||
{{ .Body }}
|
||||
</div>
|
||||
|
||||
<p><a href="/">← Alle Artikel</a></p>
|
||||
</article>
|
||||
{{ end }}
|
15
internal/web/templates/base.html
Normal file
15
internal/web/templates/base.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html><html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>{{ block "title" . }}B1tsblog{{ end }}</title>
|
||||
<link rel="stylesheet" href="/static/main.css">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com">
|
||||
<!-- Monospace‑Font für Code (optional) -->
|
||||
<link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&display=swap" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<header><h1><a href="/">B1tsblog</a></h1></header>
|
||||
<main>{{ block "body" . }}{{ end }}</main>
|
||||
<footer>© {{ now.Year }}</footer>
|
||||
</body></html>
|
16
internal/web/templates/list.html
Normal file
16
internal/web/templates/list.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{{ define "list" }} {{/* ‑‑ ausführbarer Entry‑Point */}}
|
||||
{{ template "base.html" . }} {{/* ruft das Layout auf */}}
|
||||
{{ end }}
|
||||
|
||||
{{ define "title" }}Alle Artikel{{ end }}
|
||||
|
||||
{{ define "body" }}
|
||||
<ul>
|
||||
{{ range . }}
|
||||
<li>
|
||||
<a href="/post/{{ .Slug }}">{{ .Title }}</a>
|
||||
— {{ .Date.Format "02.01.2006" }}
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
Reference in New Issue
Block a user