I’m getting close to needing a backend but would be cool if i could do it in Hugo.
Basically, I’d like to have a single .md and a single partial to genearte 100 pages that are identically looking except some middle text.
Say I have an .md like the following:
---
layout: landing
title: Foo
sections:
- section_id: stuff
type: section_stuff
start: 1
stop: 100
- section_id: patron
type: section_patron
title: Support Us
subtitle: >-
Bla bla
actions:
- label: DONATE
url: /donate
- section_id: testimonial
type: section_testimonial
title: Leave a testimonial
subtitle: >-
Bla bla
actions:
- label: Leave a testimonial
url: /testimonial
---
I then have section_stuff.html
which is a partial, given the first map (first value of the sections array) as a dict, so the partial would get the variables $start
and $stop
.
Inside this partial, I want to read from files myfile1.txt
through myfile100.txt
, do the same processing on the file content, and then output 100 different static pages corresponding to myfile1…myfile100, but dressed with the website html from hugo’s .md above.
Is there a way to achieve this without using external scripts that generate 100 different .md files? That’s what I do now via Python, and it feels silly (and a hassle to maintain external scripts)