Files
sometimescode.com/themes/sometimescode/layouts/home.html
Chris Smith 75f63ca1e8
All checks were successful
Build and Deploy Hugo Site / build-and-deploy (push) Successful in 9s
Getting there
2025-11-05 21:45:42 +01:00

44 lines
1.2 KiB
HTML

{{ define "main" }}
{{ $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 }}