Update featuredImage to use page bundle approach
This commit is contained in:
@@ -3,10 +3,13 @@ title: "{{ replace .TranslationBaseName "-" " " | title }}"
|
||||
date: {{ .Date }}
|
||||
description: ""
|
||||
categories: []
|
||||
featuredImage: ""
|
||||
featuredImageDescription: ""
|
||||
dropCap: true
|
||||
displayInMenu: false
|
||||
displayInList: true
|
||||
draft: true
|
||||
resources:
|
||||
- name: featuredImage
|
||||
src: ""
|
||||
params:
|
||||
description: ""
|
||||
---
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<a ontouchstart="cardPressed.call(this)" ontouchend="cardReleased.call(this)" ontouchmove="cardReleased.call(this)"
|
||||
href="{{ .Permalink }}" class="card blog-card" rel="bookmark" >
|
||||
{{ if isset .Params "featuredimage" }}
|
||||
{{ with .Resources.GetMatch "featuredImage" }}
|
||||
<div class="card-img-container">
|
||||
<p class="card-img-overlay">Next Article</p>
|
||||
<picture>
|
||||
{{ if (fileExists (printf "%s/%s" "static" (replace (.Params.featuredimage) (path.Ext .Params.featuredimage) ".webp"))) -}}
|
||||
<source srcset="{{ replace (.Params.featuredimage) (path.Ext (.Params.featuredimage)) ".webp" | absURL }}" type="image/webp">
|
||||
{{ with $.Resources.GetMatch (replace (.Title) (path.Ext (.Title)) ".webp") -}}
|
||||
<source srcset="{{ .Permalink }}" type="image/webp">
|
||||
{{- end }}
|
||||
<source srcset="{{ .Params.featuredimage | absURL }}">
|
||||
<img src="{{.Params.featuredimage | absURL }}" class="card-img" {{ if isset .Params "featuredimagedescription" }}alt="{{.Params.featuredimagedescription}}"{{end}}>
|
||||
<source srcset="{{ .Permalink }}">
|
||||
<img src="{{ .Permalink }}" class="card-img" {{ with .Params.description -}} alt="{{ . }}" {{- end }}>
|
||||
</picture>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<a ontouchstart="cardPressed.call(this)" ontouchend="cardReleased.call(this)" ontouchmove="cardReleased.call(this)"
|
||||
href="{{ .Permalink }}" class="card blog-card" rel="bookmark" >
|
||||
{{ if isset .Params "featuredimage" -}}
|
||||
{{ with .Resources.GetMatch "featuredImage" }}
|
||||
<div class="card-img-container">
|
||||
<picture>
|
||||
{{ if (fileExists (printf "%s/%s" "static" (replace (.Params.featuredimage) (path.Ext .Params.featuredimage) ".webp"))) -}}
|
||||
<source srcset="{{ replace (.Params.featuredimage) (path.Ext (.Params.featuredimage)) ".webp" | absURL }}" type="image/webp">
|
||||
{{ with $.Resources.GetMatch (replace (.Title) (path.Ext (.Title)) ".webp") -}}
|
||||
<source srcset="{{ .Permalink }}" type="image/webp">
|
||||
{{- end }}
|
||||
<source srcset="{{ .Params.featuredimage | absURL }}">
|
||||
<img src="{{.Params.featuredimage | absURL }}" class="card-img" {{ if isset .Params "featuredimagedescription" }}alt="{{.Params.featuredimagedescription}}"{{end}}>
|
||||
<source srcset="{{ .Permalink }}">
|
||||
<img src="{{ .Permalink }}" class="card-img" {{ with .Params.description -}} alt="{{ . }}" {{- end }}>
|
||||
</picture>
|
||||
</div>
|
||||
{{- end }}
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
<h1 class="post-title">{{ .Title }}</h1>
|
||||
<p class="post-date">Posted <time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "Jan 2, 2006" }}</time></p>
|
||||
</header>
|
||||
{{ if isset .Params "featuredimage" }}
|
||||
{{ with .Resources.GetMatch "featuredImage" }}
|
||||
<picture class="post-figure">
|
||||
{{ if (fileExists (printf "%s/%s" "static" (replace (.Params.featuredimage) (path.Ext (.Params.featuredimage)) ".webp"))) -}}
|
||||
<source srcset="{{ replace (.Params.featuredimage) (path.Ext (.Params.featuredimage)) ".webp" | absURL }}" type="image/webp">
|
||||
{{ with $.Resources.GetMatch (replace (.Title) (path.Ext (.Title)) ".webp") -}}
|
||||
<source srcset="{{ .Permalink }}" type="image/webp">
|
||||
{{- end }}
|
||||
<source srcset="{{.Params.featuredimage | absURL }}">
|
||||
<img src="{{.Params.featuredimage | absURL }}" {{ if isset .Params "featuredimagedescription" }}alt="{{.Params.featuredimagedescription}}"{{end}}>
|
||||
<source srcset="{{ .Permalink }}">
|
||||
<img src="{{ .Permalink }}" {{ with .Params.description -}} alt="{{ . }}" {{- end }}>
|
||||
</picture>
|
||||
{{ end }}
|
||||
{{ .Content }}
|
||||
|
||||
Reference in New Issue
Block a user