wjh18 / hugo-liftoff

Minimal blog/portfolio theme with a focus on content creation and SEO best practices. An ideal choice for technical users jump-starting a personal brand.
https://hugo-liftoff.netlify.app
MIT License
93 stars 27 forks source link

layouts: image: Template renders wrong images due to glob matching. #34

Closed smallkirby closed 1 year ago

smallkirby commented 1 year ago

Describe the bug In render-image.html, target image file is $resized, where $resized is fetched with with (.Page.Resources.ByType "image").GetMatch (printf "**%s" $src). However, if the image asset directory contains 2.jpg and 12.jpg, markdown ![](./img./2.jpg) unexpectedly renders 12.jpg, which "**%s matches first.

To Reproduce Steps to reproduce the behavior:

  1. In /content/posts/test directory, create index.md and img directory.
  2. Create 2.jpg and 12.jpg in img directory.
  3. Write ![](./img/2.jpg) inindex.md`.
  4. See 12.jpg is rendered instead of 2.jpg

Expected behavior 2.jpg is rendered.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.