hugo-geekdoc/exampleSite/content/shortcodes/images/_index.md

5.3 KiB

title resources
Images
name src title params
forest-1 forest-1.jpg Forest (1)
credits
[Jay Mantri](https://unsplash.com/@jaymantri) on [Unsplash](https://unsplash.com/s/photos/forest)
name src title params
forest-2 forest-2.jpg Forest (2)
credits
[Jay Mantri](https://unsplash.com/@jaymantri) on [Unsplash](https://unsplash.com/s/photos/forest)
name src title params
forest-3 forest-3.jpg Forest (3)
credits
[Jay Mantri](https://unsplash.com/@jaymantri) on [Unsplash](https://unsplash.com/s/photos/forest)
name src title params
forest-4 forest-4.jpg Forest (4)
credits
[Jay Mantri](https://unsplash.com/@jaymantri) on [Unsplash](https://unsplash.com/s/photos/forest)
name src title params
forest-5 forest-5.jpg Forest (5)
credits
[Jay Mantri](https://unsplash.com/@jaymantri) on [Unsplash](https://unsplash.com/s/photos/forest)
name src title params
forest-6 forest-6.jpg Forest (6)
credits
[Asher Ward](https://unsplash.com/@the_asher_ward) on [Unsplash](https://unsplash.com/s/photos/forest)
name src title params
forest-7 forest-7.jpg Forest (7)
credits
[Asher Ward](https://unsplash.com/@the_asher_ward) on [Unsplash](https://unsplash.com/s/photos/forest)

If you need more flexibility for your embedded images, you could use the img shortcode. It is using Hugo's page resources and supports lazy loading of your images.

Attributes:

Name Usage default
name (string) Name of the image resource defined in your front matter. empty
alt (string) Description for displayed image. resource .Title
size (string) Thumbnail size (tiny|small|medium|large). empty
lazy (bool) Enable or disable image lazy loading. Can be controlled globally by site parameter geekdocImageLazyLoading. true

Example:

Define your resources in the page front matter, custom parameter params.credits is optional.

---
resources:
  - name: forest-1
    src: "forest-1.jpg"
    title: Forest (1)
    params:
      credits: "[Jay Mantri](https://unsplash.com/@jaymantri) on [Unsplash](https://unsplash.com/s/photos/forest)"
---

{{</* img name="forest-1" size="large" lazy=false */>}}

Demo:

{{< img name="forest-1" lazy=false >}}

Dolor sit, sumo unique argument um no. Gracie nominal id xiv. Romanesque acclimates investiture. Ornateness bland it ex enc, est yeti am bongo detract re. Pro ad prompts feud gait, quid exercise emeritus bis e. In pro quints consequent, denim fastidious copious quo ad. Stet probates in duo.

{{< img name="forest-2" lazy=true >}}

Dolor sit, sumo unique argument um no. Gracie nominal id xiv. Romanesque acclimates investiture. Ornateness bland it ex enc, est yeti am bongo detract re. Pro ad prompts feud gait, quid exercise emeritus bis e. In pro quints consequent, denim fastidious copious quo ad. Stet probates in duo.

{{< img name="forest-3" lazy=true >}}

Dolor sit, sumo unique argument um no. Gracie nominal id xiv. Romanesque acclimates investiture. Ornateness bland it ex enc, est yeti am bongo detract re. Pro ad prompts feud gait, quid exercise emeritus bis e. In pro quints consequent, denim fastidious copious quo ad. Stet probates in duo.

{{< img name="forest-4" lazy=true >}}

Dolor sit, sumo unique argument um no. Gracie nominal id xiv. Romanesque acclimates investiture. Ornateness bland it ex enc, est yeti am bongo detract re. Pro ad prompts feud gait, quid exercise emeritus bis e. In pro quints consequent, denim fastidious copious quo ad. Stet probates in duo.

{{< img name="forest-5" lazy=true >}}

Dolor sit, sumo unique argument um no. Gracie nominal id xiv. Romanesque acclimates investiture. Ornateness bland it ex enc, est yeti am bongo detract re. Pro ad prompts feud gait, quid exercise emeritus bis e. In pro quints consequent, denim fastidious copious quo ad. Stet probates in duo.

{{< img name="forest-6" lazy=true >}}

Dolor sit, sumo unique argument um no. Gracie nominal id xiv. Romanesque acclimates investiture. Ornateness bland it ex enc, est yeti am bongo detract re. Pro ad prompts feud gait, quid exercise emeritus bis e. In pro quints consequent, denim fastidious copious quo ad. Stet probates in duo.

{{< img name="forest-7" lazy=true >}}