Add: Basic Hugo layouts to enable site rendering

This commit is contained in:
Greg 2025-05-25 17:19:35 +02:00
parent 63c1a13ba6
commit 43dff7d415
4 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{{ .Title }}</title>
<link rel="stylesheet" href="/css/style.css"> {{/* We'll create this later if needed */}}
</head>
<body>
<header>
<h1><a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a></h1>
</header>
<main>
{{ block "main" . }}{{ end }}
</main>
<footer>
<p>&copy; {{ now.Format "2006" }} {{ .Site.Title }}</p>
</footer>
</body>
</html>

View File

@ -0,0 +1,20 @@
{{ define "main" }}
<article>
<h2>{{ .Title }}</h2>
{{ .Content }}
</article>
<h3>Recent Posts</h3>
<ul>
{{ range first 5 .Site.RegularPages.ByDate.Reverse }}
{{/* Only show pages from the 'post' section or other main sections */}}
{{ if eq .Section "post" }}
<li>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
<p><small>Published: {{ .Date.Format "January 2, 2006" }}</small></p>
{{ .Summary }}
</li>
{{ end }}
{{ end }}
</ul>
{{ end }}

View File

@ -0,0 +1,13 @@
{{ define "main" }}
<h2>{{ .Title }}</h2>
{{ .Content }}
<ul>
{{ range .Pages.ByDate.Reverse }}
<li>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
<p><small>Published: {{ .Date.Format "January 2, 2006" }}</small></p>
{{ .Summary }}
</li>
{{ end }}
</ul>
{{ end }}

View File

@ -0,0 +1,17 @@
{{ define "main" }}
<article>
<h2>{{ .Title }}</h2>
<p><small>Published: {{ .Date.Format "January 2, 2006" }}</small></p>
{{ if .Params.tags }}
<p>
Tags:
{{ range .Params.tags }}
<a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
{{ end }}
</p>
{{ end }}
<div>
{{ .Content }}
</div>
</article>
{{ end }}