Hello everybody, new Hugo user here! I’m trying to create a Single page which will be home to an image gallery that can be updated (adding/deleting images) through Netlify’s CMS tool. My question is how do I get around to writing the logic for adding a new image to the gallery.
I tried creating a shortcode for injecting a the images into the page. However this method only allows me to set a given number of images specified in the front matter and doesn’t work for adding “new” images. Here’s what it looks like:
In the gallery page:
---
title: "Portfolio | Janelle MUA"
date: 2018-07-24T08:32:20-06:00
draft: false
gallery: [
{ thumbnail: "25" },
{ thumbnail: "29" },
{ thumbnail: "24" }
]
---
<div id="wrapper">
{{< imagecode >}}
</div>
In the imagecode.html:
<div class="portfolio-container flex">
{{ range $.Page.Params.gallery }}
<img class="portfolio-images" src="/images/{{ .thumbnail }}.jpg" alt="portfolio-image">
{{end}}
</div>
Screenshot of how the galery should look like:
I’d appreciate your help!