zwbetz-gh / cupper-hugo-theme

An accessibility-friendly Hugo theme, ported from the original Cupper project.
https://cupper-hugo-theme.netlify.app/
MIT License
301 stars 190 forks source link

failed to render shortcode "figureCupper": failed to process shortcode: #76

Closed EdwardDeaver closed 2 years ago

EdwardDeaver commented 2 years ago

Describe the bug ERROR 2022/08/30 18:23:42 Rebuild failed: : failed to render shortcode "figureCupper": failed to process shortcode: "/layouts/shortcodes/figureCupper.html:14:21": execute of template failed at <$original.Resize>: nil pointer evaluating resource.Resource.Resize

To Reproduce Steps to reproduce the behavior: Put file in static/image/something

Make a markdown post in /content/posts/myblogpost.md Put in it: {{< figureCupper img="/image/something.png" caption="The Moon is an astronomical body that orbits planet Earth and is Earth's only permanent natural satellite. It is the fifth-largest natural satellite in the Solar System, and the largest among planetary satellites relative to the size of the planet that it orbits (its primary). The Moon is after Jupiter's satellite Io the second-densest satellite in the Solar System among those whose densities are known. Credits." command="Resize" options="700x" >}}

Note this method below works: myimage Expected behavior Image with figure text should appear. Screenshots

Desktop (please complete the following information):

EdwardDeaver commented 2 years ago

btw I really like this theme. Thank you for making it.

zwbetz-gh commented 2 years ago

Hi @EdwardDeaver - this shortcode is meant to be used on a page bundle

So, given your example, restructure your page as follows

Move the markdown file from here:

content/posts/myblogpost.md

To here:

content/posts/myblogpost/index.md

Then move the image to:

content/posts/myblogpost/image/something.png