Use Hugo page resources instead of partials for changelogs

... which means we don't need to edit the top-level page for each release.
This commit is contained in:
Richard van der Hoff 2022-11-15 18:39:38 +00:00
parent ac1c5ad2bb
commit ce84f1682c
9 changed files with 12 additions and 11 deletions

View file

@ -8,11 +8,7 @@ weight: 1000
{{% changelog/changelog-changes %}}
<!-- DO NOT REMOVE OR CHANGE - Release script puts next release here -->
{{% changelog/changelog-rendered p="changelogs/v1.4.md" %}}
{{% changelog/changelog-rendered p="changelogs/v1.3.md" %}}
{{% changelog/changelog-rendered p="changelogs/v1.2.md" %}}
{{% changelog/changelog-rendered p="changelogs/v1.1.md" %}}
{{% changelog/changelogs %}}
<h2 id="historical-versions" class="no-numbers">Historical versions</h2>

View file

@ -1,2 +0,0 @@
{{ $partial := .Params.p }}
{{ partial $partial . }}

View file

@ -0,0 +1,10 @@
{{/*
This template is used to render all of the changelog sections under
"content/changelogs"
*/}}
{{ with .Page.Resources.Match "*.md" }}
{{ range ((sort . "Name" "desc")) }}
{{ .Content }}
{{ end }}
{{ end }}

5
scripts/generate-changelog.sh Normal file → Executable file
View file

@ -4,8 +4,6 @@
set -e
MAGIC_STRING="<!-- DO NOT REMOVE OR CHANGE - Release script puts next release here -->"
cd changelogs
# Pre-cleanup just in case it wasn't done on the last run
@ -31,8 +29,7 @@ cat rendered.header.md rendered.md > rendered.final.md
sed -i "s/[ ]*$//" rendered.final.md
# Put the changelog in place
mv rendered.final.md ../layouts/partials/changelogs/$1.md
sed -i "s/$MAGIC_STRING/$MAGIC_STRING\n{{% changelog\\/changelog-rendered p=\"changelogs\\/$1.md\" %}}/" ../content/changelog.md
mv rendered.final.md ../content/changelogs/$1.md
# Cleanup
rm -v rendered.*