This commit is contained in:
2025-05-04 14:16:29 +02:00
parent 92d272b36e
commit eb2d05f082
11 changed files with 202 additions and 38 deletions

View File

@@ -1,20 +1,20 @@
{{ define "article" }}
{{ template "base.html" . }}
{{ end }}
{{ define "title" }}{{ .Title }}  B1tsblog{{ 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>
<article>
{{ if .Cover }}
<img class="hero" src="{{ .Cover }}" alt="">
{{ end }}
<h1>{{ .Title }}</h1>
<time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "02.01.2006" }}</time>
<div class="article-content">
{{ .Body }}
</div>
<p><a href="/"> Alle Artikel</a></p>
<p><a href="/">Zurück zur Übersicht</a></p>
</article>
{{ end }}
{{ define "article" }}{{ template "layout" . }}{{ end }}

View File

@@ -1,15 +1,30 @@
<!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">
<!-- MonospaceFont 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>
{{ define "layout" }}
<!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">
<!-- MonospaceFont 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>
<nav>
<!-- Platz für spätere Links -->
</nav>
</header>
<main class="wrapper">
{{ template "body" . }}
</main>
<footer class="wrapper">
© {{ now.Year }} · Powered by Go
</footer>
</body>
</html>
{{ end }}

View File

@@ -1,16 +1,23 @@
{{ define "list" }} {{/* ausführbarer EntryPoint */}}
{{ template "base.html" . }} {{/* ruft das Layout auf */}}
{{ end }}
{{ define "title" }}Alle Artikel{{ end }}
{{ define "body" }}
<ul>
<ul class="post-list" style="list-style:none; padding:0; display:grid; gap:var(--gap);">
{{ range . }}
<li>
<a href="/post/{{ .Slug }}">{{ .Title }}</a>
{{ .Date.Format "02.01.2006" }}
<a class="card" href="/post/{{ .Slug }}">
{{ if .Cover }}
<img src="{{ .Cover }}" alt="">
{{ else }}
<img src="/static/img/placeholder.png" alt="">
{{ end }}
<div>
<h2>{{ .Title }}</h2>
<time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "02.01.2006" }}</time>
</div>
</a>
</li>
{{ end }}
</ul>
{{ end }}
{{ define "list" }}{{ template "layout" . }}{{ end }}