Markdownify is not rendering <figure> shortcode from a variable

I am building a complex page with Netlify CMS.
Using metadata, I am storing a markdown content:

content: >-
    This is the content.
    {{< figure src="/img/company-team.jpg" alt="Team" class="center" >}}

In the partial, I am trying to output the content using markdownify:

{{ .content | markdownify }}

This is how it looks in the browser:


I am not sure if this is supported, but I think it should be. Otherwise, what is the point of shortcodes?

markdownify parses Markdown. The figure shortcode is a Go template element! It’s supposed to be used directly in the Hugo content files, not in front-matter.

Though, you can use the Markdown syntax for inserting images in that front-matter instead.

1 Like

I read that in other place.

Do you think it will be possible to render shortcodes with markdownify in the near future?

markdownify passes the string to Blackfriday for parsing as far as I know (I am not a Hugo dev). So I doubt if it will ever start understanding Hugo shortcodes.

If you really need to use shortcodes, just use content files. If you need to break up the content into segments, as you are doing using front-matter, try looking at leaf bundles. You can break up the content into multiple content files and use one or more of those in your main content file ( via templating in your layout files.

1 Like

I didn’t not about leaf bundles. I need to learn more about it, and see if it supported in Netlify CMS.
I will post my findings here.

@kaushalmodi thank you for the quick response.