Shortcode inside define block

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

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

baseof.html

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

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

2 Likes