Getting there
All checks were successful
Build and Deploy Hugo Site / build-and-deploy (push) Successful in 9s

This commit is contained in:
Chris Smith
2025-11-05 21:45:42 +01:00
parent c7d8f4868b
commit 75f63ca1e8
13 changed files with 931 additions and 26 deletions

View File

@@ -1,7 +1,43 @@
{{ define "main" }}
{{ .Content }}
{{ range site.RegularPages }}
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ .Summary }}
{{ end }}
{{ $welcomePost := where site.RegularPages "Title" "Welcome to Sometimes Code" | first 1 }}
{{ $otherPosts := where site.RegularPages "Section" "posts" }}
{{ $otherPosts := where $otherPosts "Title" "!=" "Welcome to Sometimes Code" }}
{{ range $welcomePost }}
<article class="featured-post">
<h1>{{ .Title }}</h1>
<div class="post-meta">
<time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "January 2, 2006" }}</time>
</div>
<div class="featured-content">
{{ .Content }}
</div>
</article>
{{ end }}
<h2>Latest Posts</h2>
<section class="posts-list">
{{ range $otherPosts }}
<article class="post-summary">
<h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
<div class="post-meta">
<time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "January 2, 2006" }}</time>
{{ with .Params.categories }}
<span class="post-categories">
{{ range . }}
<span class="category">{{ . }}</span>
{{ end }}
</span>
{{ end }}
</div>
<div class="post-excerpt">
{{ .Summary }}
{{ if .Truncated }}
<a href="{{ .RelPermalink }}" class="read-more">Read more →</a>
{{ end }}
</div>
</article>
{{ end }}
</section>
{{ end }}