I actually already knew how to do this, but it took my brain a bit to recall the keystrokes, so writing up a TIL.
In this example, I’m going to make a projects page that’ll be at the url /projects
.
mkdir -p content/projects
touch -p content/projects/_default.md
content/projects/_default.md
that’s used in the generated html.
---
title: Projects
---
touch layouts/section/projects.html
themes/hugo-blog-awesome/layouts
Create a content directory: mkdir -p content/projects
Add a default page: touch -p content/projects/_default.md
Write the content in the page
Make sure that the list template that’s used at /projects
uses {{ .Content }}
.
For example, I needed to make sure that {{ .Content }}
was in themes/hugo-blog-awesome/layouts/_default/list.html
{{- define "main" -}}
<div class="wrapper list-page">
<header class="header">
<h1 class="header-title center">{{ .Title }}</h1>
</header>
<main class="page-content" aria-label="Content">
{{ .Content }} {{ range .Pages.GroupByDate "2006" }} {{ $year := .Key
}}
<h2 class="post-year">{{ $year }}</h2>
{{/* create a list of posts for each month, with month as heading */}}
{{ range .Pages }} {{ partial "postCard" . }} {{ end }} {{/* end range
.Pages */}} {{ end }} {{/* end range .Pages.GroupByDate "2006" */}}
</main>
</div>
{{- end -}}