You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.3KB

  1. {{ $src := .Get "src" }}
  2. {{ $lqipsrc := .Get "lqipsrc" }}
  3. {{ $caption := .Get "caption" }}
  4. {{ $link := .Get "link" }}
  5. {{ $linktarget := .Get "linktarget" }}
  6. {{ $attr := .Get "attr" }}
  7. {{ $attrlink := .Get "attrlink" }}
  8. {{ $alt := .Get "alt" }}
  9. {{ $title := .Get "title" }}
  10. {{ $class := .Get "class" }}
  11. <figure{{ with $class }} class="{{ . }}"{{ end }}>
  12. {{ with $link }}<a href="{{ . }}"{{ if $linktarget }} target="{{ $linktarget }}"{{ end }}{{ if eq $linktarget "_blank" }} rel="external noopener noreferrer"{{ end }}>{{ end }}
  13. {{ if $lqipsrc }}
  14. <img class="lazyload blur-up" src="{{ $lqipsrc }}" data-src="{{ $src }}" {{ if or $alt $caption }}alt="{{ with $alt }}{{ . }}{{ else }}{{ $caption }}{{ end }}"{{ end }} />
  15. {{ else }}
  16. <img class="lazyload" data-src="{{ $src }}" {{ if or $alt $caption }}alt="{{ with $alt }}{{ . }}{{ else }}{{ $caption }}{{ end }}"{{ end }} />
  17. {{ end }}
  18. {{ if $link }}</a>{{ end }}
  19. {{ if or (or $title $caption) $attr }}
  20. <figcaption>{{ if isset .Params "title" }}
  21. <header><b>{{ $title }}</b></header>{{ end }}
  22. {{ if or $caption $attr }}
  23. <small>{{ $caption }}
  24. {{ with $attrlink }}<a href="{{ . }}"> {{ end }}
  25. {{ $attr }}
  26. {{ if $attrlink }}</a> {{ end }}
  27. </small>{{ end }}
  28. </figcaption>
  29. {{ end }}
  30. </figure>