2020-07-06 18:55:32 +00:00
|
|
|
---
|
2020-07-27 18:17:55 +00:00
|
|
|
title: "Post with images"
|
2020-07-06 18:55:32 +00:00
|
|
|
date: 2020-06-22T20:00:00+02:00
|
|
|
|
authors:
|
|
|
|
- richard-roe
|
2020-07-22 08:51:13 +00:00
|
|
|
- john-doe
|
2020-07-06 18:55:32 +00:00
|
|
|
tags:
|
|
|
|
- Open Source
|
|
|
|
- Development
|
2020-07-27 18:17:55 +00:00
|
|
|
resources:
|
2021-02-21 12:45:21 +00:00
|
|
|
- name: feature
|
|
|
|
src: "images/feature.jpg"
|
|
|
|
params:
|
|
|
|
credits: "[Angelina Litvin](https://unsplash.com/@linalitvina) on [Unsplash](https://unsplash.com/s/photos/writing)"
|
2020-07-27 18:17:55 +00:00
|
|
|
- name: testimage
|
2020-09-12 16:20:46 +00:00
|
|
|
src: "images/testimage.jpg"
|
2020-07-27 18:17:55 +00:00
|
|
|
title: This is a test image
|
|
|
|
params:
|
|
|
|
credits: "[David Pennington](https://unsplash.com/@dtpennington) on [Unsplash](https://unsplash.com/s/photos/test)"
|
2020-07-06 18:55:32 +00:00
|
|
|
---
|
|
|
|
|
2021-02-21 13:45:41 +00:00
|
|
|
If you need more flexibility for your embedded images, you could use the `img` shortcode. It is using Hugo's
|
|
|
|
[page resources](https://gohugo.io/content-management/page-resources/) and supports lazy loading of your images.
|
2020-07-06 18:55:32 +00:00
|
|
|
|
2021-02-21 13:45:41 +00:00
|
|
|
**Attributes:**
|
2020-07-27 18:17:55 +00:00
|
|
|
|
2021-02-21 13:45:41 +00:00
|
|
|
| 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 `geekblogImageLazyLoading`. | true |
|
|
|
|
|
|
|
|
**Example:**
|
|
|
|
|
|
|
|
Define your resources in the page front matter, custom parameter `params.credits` is optional.
|
|
|
|
|
|
|
|
<!-- spellchecker-disable -->
|
|
|
|
|
|
|
|
```md
|
|
|
|
---
|
|
|
|
resources:
|
|
|
|
- name: testimage
|
|
|
|
src: "images/testimage.jpg"
|
|
|
|
title: This is a test image
|
|
|
|
params:
|
|
|
|
credits: "[David Pennington](https://unsplash.com/@dtpennington) on [Unsplash](https://unsplash.com/s/photos/test)"
|
|
|
|
---
|
|
|
|
|
|
|
|
{{</* img name="testimage" size="small" lazy=true */>}}
|
|
|
|
```
|
|
|
|
|
|
|
|
<!-- spellchecker-enable -->
|
|
|
|
|
|
|
|
{{< img name="testimage" size="small" lazy=true >}}
|