https://blog.naskya.net/

[[ 🗃 ^wzWnj blog ]] :: [📥 Inbox] [📤 Outbox] [💥 Errbox] [🐤 Followers] [🤝 Collaborators] [🏗 Projects] [🛠 Commits]

Clone

HTTPS: git clone https://code.naskya.net/repos/wzWnj

SSH: git clone USERNAME@code.naskya.net:wzWnj

Branches

Tags

main :: themes / hugo-tania-custom / layouts / _default / _markup /

render-image.html

{{- if strings.HasPrefix .Destination "http" -}}
  <img loading="lazy" 
    src="{{ .Destination | safeURL }}" 
    alt="{{ .Text }}" 
    {{ with .Title}} title="{{ . }}"{{ end }} />
{{- else -}}
  {{- $image := .Page.Resources.GetMatch (printf "%s" (.Destination | safeURL)) -}}
  {{- $permalink := "" -}}

  {{- if ne $image nil -}}
  {{- $permalink = $image.RelPermalink -}}
  {{- else -}}
  {{- $image = imageConfig (printf "static/%s" (.Destination | safeURL)) -}}
  {{- $permalink = (printf "/%s" (.Destination | safeURL)) -}}
  {{- end -}}

  <img loading="lazy" 
    src="{{ $permalink }}" 
    alt="{{ .Text }}" 
    {{ with .Title}} title="{{ . }}"{{ end }} 
    width={{ $image.Width }} 
    height="{{ $image.Height }}"  />
{{- end -}}
[See repo JSON]