Gallery shortcode not working

I’m trying to incorporate this gallery shortcode theme into my website. I’ve followed the instructions as they stand.

I’ve edited my config.yaml to this:

theme: 
    - hugo-theme-novela
    - hugo-shortcode-gallery
baseURL: "https://example.com"
languageCode: "en-us"

I’ve also cloned it into the themes folder. According to the installation instructions, this should be enough to get me started. However when I add a new folder called images next to the _index.md inside content and us this shortcode, nothing shows up:

---
hero:
  heading: A Whole Sort of General Mishmash
  maxWidthPX: 400
seo:
  image: /images/hero-2.jpg
---
{{< gallery match="images/*" sortOrder="desc" rowHeight="150" margins="5" resizeOptions="600x300 q90 Lanczos" showExif="true" previewType="blur" embedPreview="true" >}}

I’ve uploaded all the files to this repo here if that helps: Website Repo. Can someone help me with this? I’ve been trying for a while now. I’m new to Hugo so I might be missing something that is very simple.

Page resources for _index.md need to live in the same directory as the _index.md, i.e. not in a subdir: https://gohugo.io/content-management/page-bundles/

1 Like

Based on what you said, I’ve shifted the images into the content folder and not in a subdir within:

What should the shortcode be changed to? This is what I did:

{{< gallery match="/*" showExif="true" sortOrder="desc" loadJQuery="true" embedPreview="true" filterOptions="[{label: 'All', tags: '.'}, {label: 'Amphibian', tags: 'animal|amphibian'}]">}}

I’m pasting this shortcode inside the _index.md, that is correct right? I shouldn’t be placing it inside the layouts or something?

Yes, you should be using the shortcode inside a content file.

If you mean that you are using your shortcode inside content/_index.md: your theme’s layouts/index.html does not render {{ .Content }}, so it never parses the shortcode.


The shortcode looks fairly complex. You may want to ask the maintainer for help on how to use their component.

1 Like

If you mean that you are using your shortcode inside content/_index.md : your theme’s layouts/index.html does not render {{ .Content }} , so it never parses the shortcode.

This was it! Thank you again.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.