My problem is resource.Get does not work under Content .md files, but if I put the code on the layout baseof.html, it works. The image is under assets/images/ecosystem.jpg. Below are the pictures:
Inside the content file: 2024-04-03-I-Like-to-roar.md
---
title: I like to roar
date: 2024-04-03
---
{{ $image := resources.Get "images/ecosystem.webp" }}
<img src="{{ ($image.Resize "200x").RelPermalink }}"/>
Testing Post with Image
I have tried using the following paths e.g., images/ecosystem.jpg, /images/ecosystem.jpg, ecosystem.jpg, /ecosystem.jpg, asset/images/ecosystem.jpg, /assets/images/ecosystem.png, etc., but none works.
But if I put the above code inside the html body inside baseof.html, then the image is displayed.
Why is it not working under the Content Posts .md files?
The image render hook has the advantage that you can use standard MD syntax to add your image. Which is better supported by editors than shortcodes, afaik.