# Shortcode inside define block

**URL:** https://discourse.gohugo.io/t/shortcode-inside-define-block/39410
**Category:** support
**Created:** [July 8, 2022, 8:45am UTC](https://discourse.gohugo.io/t/shortcode-inside-define-block/39410 "2022-07-08T08:45:03Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![bullet](https://avatars.discourse-cdn.com/v4/letter/b/e95f7d/32.png) [@bullet](https://discourse.gohugo.io/u/bullet)
#### Post date: [July 8, 2022, 8:45am UTC](https://discourse.gohugo.io/t/shortcode-inside-define-block/39410/1 "2022-07-08T08:45:03Z")

</div>

Hi everyone!

I have a shortcode, which i would like to insert inside define block. When I try to do it, I get a mistake `unexpected "<" in command`.

1. Can I do it this way?
2. If yes, what is the correct syntax?  
Here is the code structure:

myshortcode.html  
`<iframe src="{{ .Get 0 }}</iframe>`

index.html

```auto
{{ define "mysection-section" }}
  ...some regular html code
  {{< myshortcode "somesource" >}} // where mistake happens
  ...some regular html code
{{ end }}

```

baseof.html

```auto
<body class="body">
  <div>
    {{ block "mysection-section" . }}{{ end }}
  </div>
</body>

```

---

<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: [July 8, 2022, 9:08am UTC](https://discourse.gohugo.io/t/shortcode-inside-define-block/39410/2 "2022-07-08T09:08:45Z")

</div>

Shortcodes can only be used in content files (and in the RenderString method).
