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.

46 lines
1.5 KiB

4 years ago
  1. +++
  2. title = "Figure"
  3. description = "Load images progressively with blurry placeholders."
  4. categories = ["experience"]
  5. tags = ["performance", "images", "graphics"]
  6. html_attributes = ["class", "alt", "src"]
  7. custom_attributes = ["lqipsrc", "caption", "link", "linktarget", "attr", "attrlink", "title"]
  8. snippets_used = ["external"]
  9. notes = [
  10. "review 'lazy-loading' if this page is modified"
  11. ]
  12. [[copyright]]
  13. owner = "Josh Habdas"
  14. date = "2019"
  15. license = "agpl-3.0-or-later"
  16. +++
  17. With progressive image placeholder:
  18. ```html
  19. {{</* figure
  20. alt="Artistic map"
  21. src="/images/watercolor_pTIyYTqAlF8_w1440h700.jpeg"
  22. lqipsrc="/images/watercolor_pTIyYTqAlF8_w936h455.jpeg"
  23. title="Map of Bali in Watercolor"
  24. attr="Stamen Design"
  25. attrlink="https://maps.stamen.com/"
  26. */>}}
  27. ```
  28. {{< figure
  29. alt="Artistic map"
  30. src="/images/watercolor_pTIyYTqAlF8_w936h455.jpeg"
  31. lqipsrc="/images/watercolor_pTIyYTqAlF8_w1440h700.jpeg"
  32. title="Map of Bali in Watercolor"
  33. attr="Stamen Design"
  34. attrlink="https://maps.stamen.com/"
  35. >}}
  36. Above as a [Snippet](/feature/snippets/) used in a [Custom Layout](/feature/custom-layouts/):
  37. ```go-html-template
  38. {{ partial "components/figure.html" (dict "alt" "Artistic map" "src" "/images/watercolor_pTIyYTqAlF8_w936h455.jpeg" "lqipsrc" "/images/watercolor_pTIyYTqAlF8_w1440h700.jpeg" "title" "Map of Bali in Watercolor" "attr" "Stamen Design" "attrlink" "https://maps.stamen.com/") }}
  39. ```
  40. See {{< external href="https://gohugo.io/content-management/shortcodes/#figure" text="Figures in Hugo" />}} for Hugo-specific implementation.