Ive been tinkering on this for some time, but can’t get the results I’m looking for.
I want to build a simple one page website that takes text and images from the mystuff
folder. The only page to get published is _index.html
.
My setup:
content
|--- _index.html
|--- mystuff
|--- index.html [headless = true]
|--- post1
|--- index.md
|--- post1.jpg
|--- bio
|--- index.md
|--- bio.jpg
In layouts/index.html
, this gives all the content:
{{ $headlessbundle := .GetPage ("/mystuff") }}
{{ range $headlessbundle.Resources }}
{{ . }}
{{ end }}
This gives the images:
{{ $headlessbundle := .GetPage ("/mystuff") }}
{{ range $headlessbundle.Resources.ByType "image" }}
{{ . }}
{{ end }}
Then the contents:
{{ $headlessbundle := .GetPage ("/mystuff") }}
{{ range $headlessbundle.Resources.ByType "page" }}
{{ . }}
{{ end }}
How do I combine the image and content statements, so I get the following output:
<h1>Post1</h1>
<img src = "post1.jpg">
<h1>Bio</h1>
<img src = "bio.jpg">
I can only get it two give:
<h1>Bio</h1>
<h1>Post1</h1>
<img src = "bio.jpg">
<img src = "post1.jpg">