With the data structure below, how do I get the images to show up in the assets folder? `Do I need to move them to static and mount to assets?
[
{
"id": 1,
"name": "Window Pane",
"description": "The best window pane in town",
"price": 99,
"images": [
"/images/SKUWP-window-pane.jpg",
"/images/SKUWP2-window-pane.jpg",
"/images/SKUWP3-window-pane.jpg"
],
"category": "Windows"
},
]
This code fails to show any images in the assets folder
Summary
{{ $products := .Site.Data.products }}
{{ range $index, $product := $products }}
<h2>{{ $product.name }}</h2>
<!-- Featured Image -->
{{ $featuredImage := (index $product.images 0) }}
{{ if $featuredImage }}
{{ $featuredResource := resources.Get $featuredImage }}
{{ if $featuredResource }}
<div class="featured-image">
<img src="{{ $featuredResource.RelPermalink }}" alt="{{ $product.name }} featured image">
</div>
{{ else }}
<p>Featured image not found: {{ $featuredImage }}</p>
{{ end }}
{{ end }}
<!-- Other Images -->
<div class="product-images">
{{ range $image := $product.images }}
{{ $imageResource := resources.Get $image }}
{{ if $imageResource }}
<img src="{{ $imageResource.RelPermalink }}" alt="{{ $product.name }} image {{ $index }}">
{{ else }}
<p>Image not found: {{ $image }}</p>
{{ end }}
{{ end }}
</div>
{{ end }}