# Including images in a markdown

**URL:** <https://discourse.gohugo.io/t/including-images-in-a-markdown/26183>\
**Category:** support\
**Created:** [June 11, 2020, 2:51am UTC](https://discourse.gohugo.io/t/including-images-in-a-markdown/26183 "2020-06-11T02:51:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hendry](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/hendry/32/7037_2.png) [@hendry](https://discourse.gohugo.io/u/hendry)\
**Post date:** [June 11, 2020, 2:51am UTC](https://discourse.gohugo.io/t/including-images-in-a-markdown/26183/1 "2020-06-11T02:51:03Z")

</div>

Hi! In a section of my markdown, I’d like to do something like:

```
{{ $files := readDir /static/gallery }}
{{ range $files }}  
<figure><img src="{{$url}}/{{.Name | urlize }}"></figure> 
{{ end }}

```

But it doesn’t work of course when I try. I am not sure what I’m supposed to do here.  
Create a shortcode? Move the content a layouts/mypage.html instead?

---

<div class="post-metadata">

**Author:** ![pamubay](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pamubay/32/17838_2.png) [@pamubay](https://discourse.gohugo.io/u/pamubay)\
**Post date:** [June 11, 2020, 5:47am UTC](https://discourse.gohugo.io/t/including-images-in-a-markdown/26183/2 "2020-06-11T05:47:14Z")

</div>

Use inline shortcodes.

> **[Create Your Own Shortcodes](https://gohugo.io/templates/shortcode-templates/#inline-shortcodes)**
>
> You can extend Hugo's built-in shortcodes by creating your own using the same templating syntax as that for single and list pages.

---

<div class="post-metadata">

**Author:** ![hendry](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/hendry/32/7037_2.png) [@hendry](https://discourse.gohugo.io/u/hendry)\
**Post date:** [June 11, 2020, 7:37am UTC](https://discourse.gohugo.io/t/including-images-in-a-markdown/26183/3 "2020-06-11T07:37:40Z")

</div>

Thank you! The syntax is really gnarly. I don’t understand the point of it.

```
{{< couldbeanything.inline >}}
Go template
{{< /couldbeanything.inline >}}
```

---

<div class="post-metadata">

**Author:** ![ju52](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ju52/32/6749_2.png) [@ju52](https://discourse.gohugo.io/u/ju52)\
**Post date:** [June 11, 2020, 10:12am UTC](https://discourse.gohugo.io/t/including-images-in-a-markdown/26183/4 "2020-06-11T10:12:24Z")

</div>

I made this thing with **fancybox** as gallery viewer.  
my sample tamplete is here:

> <https://github.com/gj52/HugoSample/blob/master/themes/photon/layouts/photo/gallery.html>

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [June 13, 2020, 10:12am UTC](https://discourse.gohugo.io/t/including-images-in-a-markdown/26183/5 "2020-06-13T10:12:27Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
