Add news posts with banner summaries on the home page
Posts live in content/post/; the five latest are summarised on the home page. Builds for check/deploy go to build/ so they do not collide with a running hugo server writing to public/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YDRjtmAiNpo5mK5N3d7QwZ
This commit is contained in:
+13
-2
@@ -1,14 +1,25 @@
|
||||
{{ define "main" }}
|
||||
<h1>{{ .Title }}</h1>
|
||||
<div class="content">{{ .Content }}</div>
|
||||
{{ with site.GetPage "/post" }}
|
||||
{{ $posts := .RegularPages.ByDate.Reverse }}
|
||||
{{ if $posts }}
|
||||
<h2>{{ .Title }}</h2>
|
||||
<div class="posts">
|
||||
{{ range first 5 $posts }}{{ partial "post-summary.html" . }}{{ end }}
|
||||
</div>
|
||||
{{ if gt (len $posts) 5 }}<p><a href="{{ .RelPermalink }}">All posts →</a></p>{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<h2>Sections</h2>
|
||||
<div class="cards">
|
||||
{{ range site.Menus.main }}
|
||||
{{ with .Page }}
|
||||
{{ with .Page }}{{ if ne .Section "post" }}
|
||||
<a class="card" href="{{ .RelPermalink }}">
|
||||
<strong>{{ .Title }}</strong>
|
||||
<span>{{ len .RegularPages }} {{ if eq (len .RegularPages) 1 }}page{{ else }}pages{{ end }}</span>
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ end }}{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
<h2>Browse the museum</h2>
|
||||
|
||||
Reference in New Issue
Block a user