Umstellung auf dynamische Templates
This commit is contained in:
20
templates/article.html
Normal file
20
templates/article.html
Normal file
@@ -0,0 +1,20 @@
|
||||
{{ define "title" }}{{ .Title }} – B1tsblog{{ end }}
|
||||
|
||||
{{ define "body" }}
|
||||
<article>
|
||||
{{ if .Cover }}
|
||||
<img class="hero" src="{{ .Cover }}" alt="">
|
||||
{{ end }}
|
||||
<p><a class="no-underline" href="/">← Zurück zur Übersicht</a></p>
|
||||
<h1>{{ .Title }}</h1>
|
||||
<time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "02.01.2006" }}</time>
|
||||
|
||||
<div class="article-content">
|
||||
{{ .Body }}
|
||||
</div>
|
||||
|
||||
<p><a class="no-underline" href="/">← Zurück zur Übersicht</a></p>
|
||||
</article>
|
||||
{{ end }}
|
||||
|
||||
{{ define "article" }}{{ template "layout" . }}{{ end }}
|
39
templates/base.html
Normal file
39
templates/base.html
Normal file
@@ -0,0 +1,39 @@
|
||||
{{ define "layout" }}
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
{{ if .Description }}
|
||||
<meta name="description" content="{{ .Description }}">
|
||||
{{ end }}
|
||||
<title>{{ block "title" . }}B1tsblog{{ end }}</title>
|
||||
<link rel="icon" type="image/vnd.icon" href="/static/img/favicon.ico">
|
||||
<link rel="stylesheet" href="/static/main.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1><a href="/" class="no-underline">B1tsblog</a></h1>
|
||||
<nav class="main-nav">
|
||||
<ul>
|
||||
<li><a class="no-underline" href="/">Start</a></li>
|
||||
<li><a class="no-underline" href="/page/welcome">Hallo</a></li>
|
||||
<li><a class="no-underline" href="/page/ai">KI</a></li>
|
||||
<li><a class="no-underline" href="/page/datenschutzerklaerung">Datenschutz</a></li>
|
||||
<li><a class="no-underline" href="/page/impressum">Impressum</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main class="wrapper">
|
||||
{{ template "body" . }}
|
||||
</main>
|
||||
|
||||
<footer class="wrapper">
|
||||
© {{ now.Year }} · Jan Bergner / B1tsBlog
|
||||
<hr>
|
||||
Ich verzichte auf Cookies, affiliate Links, Tracking und die Einbindung von Drittanbieter-Diensten.
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
{{ end }}
|
19
templates/list.html
Normal file
19
templates/list.html
Normal file
@@ -0,0 +1,19 @@
|
||||
{{ define "body" }}
|
||||
<ul class="post-list">
|
||||
{{ range .Articles }}
|
||||
<li>
|
||||
<a class="card no-underline" href="/post/{{ .Slug }}">
|
||||
{{ if .Cover }}
|
||||
<img src="{{ .Cover }}" alt="">
|
||||
{{ else }}
|
||||
<img src="/static/img/placeholder.webp" alt="">
|
||||
{{ end }}
|
||||
<div class="card-content">
|
||||
<h2>{{ .Title }}</h2>
|
||||
<time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "02.01.2006" }}</time>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
12
templates/page.html
Normal file
12
templates/page.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{{ define "title" }}{{ .Title }} – B1tsblog{{ end }}
|
||||
|
||||
{{ define "body" }}
|
||||
<article>
|
||||
<p><a class="no-underline" href="/">← Zurück</a></p>
|
||||
<h1>{{ .Title }}</h1>
|
||||
<div class="article-content">{{ .Body }}</div>
|
||||
<p><a class="no-underline" href="/">← Zurück</a></p>
|
||||
</article>
|
||||
{{ end }}
|
||||
|
||||
{{ define "page" }}{{ template "layout" . }}{{ end }}
|
Reference in New Issue
Block a user