Initial commit: TechCare Hugo site
Hugo site scaffold with blog and hardware pages, layouts, styles, fonts, and image assets.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
{{- /* Resolves a front-matter "featured" path (relative to assets/) through
|
||||
Hugo's image pipeline. Hugo's Resize also scales up, so only convert to
|
||||
WebP and shrink when the source is wider than the given width. */ -}}
|
||||
{{- $path := .path -}}
|
||||
{{- $max := .max -}}
|
||||
{{- $class := .class -}}
|
||||
{{- $alt := .alt | default "" -}}
|
||||
{{- $loading := .loading | default "eager" -}}
|
||||
{{- with resources.Get $path -}}
|
||||
{{- $img := . -}}
|
||||
{{- if and (eq $img.ResourceType "image") (gt $img.Width $max) -}}
|
||||
{{- $img = $img.Resize (printf "%dx q82 webp" $max) -}}
|
||||
{{- end -}}
|
||||
<img class="{{ $class }}" src="{{ $img.RelPermalink }}" alt="{{ $alt }}" width="{{ $img.Width }}" height="{{ $img.Height }}" loading="{{ $loading }}" decoding="async"{{ if eq $loading "eager" }} fetchpriority="high"{{ end }}>
|
||||
{{- else -}}
|
||||
{{- warnf "featured image not found in assets: %s" $path -}}
|
||||
{{- end -}}
|
||||
Reference in New Issue
Block a user