# Rendering content with shortcode

**URL:** <https://discourse.gohugo.io/t/rendering-content-with-shortcode/16311>\
**Category:** support\
**Created:** [January 11, 2019, 7:59am UTC](https://discourse.gohugo.io/t/rendering-content-with-shortcode/16311 "2019-01-11T07:59:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![flashpixx](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/flashpixx/32/1795_2.png) [@flashpixx](https://discourse.gohugo.io/u/flashpixx)\
**Post date:** [January 11, 2019, 7:59am UTC](https://discourse.gohugo.io/t/rendering-content-with-shortcode/16311/1 "2019-01-11T07:59:30Z")

</div>

Hello,

I have got some yaml data files which contains some page content e.g.

```
 content: '# foo {{< myshortcode >}}'

```

I try to run

```
.Site.Data.mydatafile.content | markdownify

```

but the shortcode is not processed. How can I process content of a variable with shortcodes?  
Thanks

---

<div class="post-metadata">

**Author:** ![Weru](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/weru/32/7300_2.png) [@Weru](https://discourse.gohugo.io/u/Weru)\
**Post date:** [January 11, 2019, 9:03am UTC](https://discourse.gohugo.io/t/rendering-content-with-shortcode/16311/2 "2019-01-11T09:03:09Z")

</div>

You’re supposed to call your shortcodes from your content files. It seems as though you’re trying to call the shortcode from your layouts template. The docs say that shortcodes should only be called from content files.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [January 11, 2019, 9:04am UTC](https://discourse.gohugo.io/t/rendering-content-with-shortcode/16311/3 "2019-01-11T09:04:20Z")

</div>

Yes, shortcodes are currently not processed when you run `markdownify`.

---

<div class="post-metadata">

**Author:** ![flashpixx](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/flashpixx/32/1795_2.png) [@flashpixx](https://discourse.gohugo.io/u/flashpixx)\
**Post date:** [January 11, 2019, 9:12am UTC](https://discourse.gohugo.io/t/rendering-content-with-shortcode/16311/4 "2019-01-11T09:12:17Z")

</div>

My problem is, that I have multiple content files which contains equal sections and I would like to store these sections once and would like to include it into the content file. So I would like to store the content once and include it multiple time like the C include command.

Did you have any suggestion to do this?

---

<div class="post-metadata">

**Author:** ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)\
**Post date:** [January 11, 2019, 1:50pm UTC](https://discourse.gohugo.io/t/rendering-content-with-shortcode/16311/5 "2019-01-11T13:50:31Z")

</div>

You could handle it in your templates. Say you had a front matter param `includeContent`. If that’s true, then include the content. There are many other ways to do this too.

---

<div class="post-metadata">

**Author:** ![\_nm](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/_nm/32/7662_2.png) [@\_nm](https://discourse.gohugo.io/u/_nm)\
**Post date:** [January 12, 2019, 2:31pm UTC](https://discourse.gohugo.io/t/rendering-content-with-shortcode/16311/6 "2019-01-12T14:31:47Z")

</div>

I use includes a lot in my writing and while learning Hugo, I’ve done a lot of experiments trying to figure out the best way to do this. My solution is to write my content in AsciiDoc format because it supports includes (and a lot of other good stuff). My path towards this solution included trying:

- shortcodes (as you’ve tried)
- mmark format, which supports includes
- org-mode format, which supports includes
- pandoc, which supports includes

You can read about the content formats that Hugo supports here:

> **[Supported Content Formats](https://gohugo.io/content-management/formats/)**
>
> Both HTML and Markdown are supported content formats.
