what I need is to make Hugo processing the image inside the content by using shortcodes. There is 2 scenariom the first one is get the image from the front matter param and the other one is directly from the value inside the shortcode it self
so far i manage to make the first scenario working, here’s my workaround
the problem is i’m stuck in the second scenario where i have to define the image src inside my shortcode eg {{< image src="takoyaki.jpg" >}} my goal is to have responsive image using src-set
<figure class="image-caption">
{{ with .Get "link"}}<a href="{{.}}">{{ end }}
<img data-sizes="auto" class="lazyload" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}"{{ end }}
<!-- image processsing -->
{{ $imageResource := (.Get "src").Resources.GetMatch (strings.TrimPrefix "/uploads/" . ) }}
{{ $desktop := $imageResource.Fill "200x200 Center" }}
data-srcset="{{ $desktop.RelPermalink }}" />
{{ if .Get "link"}}</a>{{ end }}
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
<figcaption>{{ if isset .Params "title" }}
<h5>{{ .Get "title" }}</h5>{{ end }}
{{ if or (.Get "caption") (.Get "attr")}}<p>
{{ .Get "caption" }}
{{ with .Get "attrlink"}}<a href="{{.}}"> {{ end }}
{{ .Get "attr" }}
{{ if .Get "attrlink"}}</a> {{ end }}
</p> {{ end }}
</figcaption>
{{ end }}
</figure>
then call the image inside content with {{< image src="takoyaki.jpg" title="Takoyaki" >}} and the errors still the same
ERROR 2018/12/04 17:58:03 "E:\YUDY\WEB PROJECT\TIAVI\sites\newdev\content\culinary\recipe\ini-loh-cara-membuat-takoyaki-yang-lezat-dan-praktis\index.md:64:1": failed to render shortcode "image": "E:\YUDY\WEB PROJECT\TIAVI\sites\newdev\themes\gogirl\layouts\shortcodes\image.html:4:35": execute of template failed: template: shortcodes/image.html:4:35: executing "shortcodes/image.html" at <"src">: can't evaluate field Resources in type string
<figure class="image-caption">
<img data-sizes="auto" class="lazyload"
{{ $imageResource := .Page.Resources.GetMatch (printf "*/uploads/%s*" (.Get "src")) }}
{{ $mobile := $imageResource.Fill "458x254 Center" }} <!-- i assume this part is the source of the error -->
data-srcset="{{ .Get "src" }}" />
<figcaption>{{ if isset .Params "title" }}
<h5>{{ .Get "title" }}</h5>{{ end }}
</figcaption>
</figure>
output error
"E:\YUDY\WEB PROJECT\TIAVI\sites\newdev\content\culinary\recipe\ini-loh-cara-membuat-takoyaki-yang-lezat-dan-praktis\index.md:64:1": failed to render shortcode "image": "E:\YUDY\WEB PROJECT\TIAVI\sites\newdev\themes\gogirl\layouts\shortcodes\image.html:5:36": execute of template failed: template: shortcodes/image.html:5:36: executing "shortcodes/image.html" at <$imageResource.Fill>: can't evaluate field Fill in type resource.Resource
You were never setting the src attribute for your <img>
The Forestry article you linked is cool, but they have one thing wrong. In order for content/uploads/_index.md to be headless, it must be a leaf bundle. So change _index.md to index.md
I’m also not sure how the .GetMatch example they gave is working
With all that said, give content structure like this: