Hi,
In my index.md file for article, I have the following front matter:
date: 2018-08-29
title: "A big project with featured image"
description: "With pictures it's much better"
categories: ["Photo"]
tags: ["project", "image"]
resources:
- src: sunset.jpg
name: header thumbnail
The resources has 2 names (header and thumbnail), one used for image processing in a specific layout (single) and the second name requested by another theme.
When having only one name it works well, but not with two names for the same theme.
Is it possible to have 2 different names for the same resource (in bundle leaf) and how to deal with?
-
Image is displayed with the single layout (extract)
{{ with $.Resources.GetMatch “header” }}
{{ $tinyw := .Resize “500x” }}
{{ $smallw := .Resize “800x” }}
{{ $mediumw := .Resize “1200x” }}
{{ $largew := .Resize “1500x” }}
img
class=“lazyload blur-up”
alt="{{ .Name | plainify }}"
src="{{ $smallw.RelPermalink }}"
srcset="{{ $tinyw.RelPermalink }} 320w,{{ $smallw.RelPermalink }} 768w,{{ $mediumw.RelPermalink }} 1024w,{{ $largew.RelPermalink }} 1280w" sizes=“90vw”>
{{- end }} -
Image is not displayed in the list layout (extract):
span class=“post-title”>
{{ if .Resources.GetMatch “header” }}
{{ $image100 := (.Resources.GetMatch “header”).Fill “100x100 Center” }}
img class=“lazyload blur-up” data-src="{{ $image100.RelPermalink }}" alt="{{ .Name | plainify }}" > {{ end }}
h3 >{{ .Title }}
p>{{- .Description -}}/p>
/span>
Note that when I delete the second name in front matter (thumbnail) every is fine without modifying both layouts.