[Solved] How to check if .Content is empty

Hello,

I want to check if the .md file has content so i can show some special html structure around it. And i cannot find a way (i tried with isset).

{{ if .Content }}
<div class="special-wrapper">
 {{ .Content }}
</div>
{{ end }}

How about len?

3 Likes

@alexandros you are a genius, thank you!

I tend to use with for just about everything. For example:

{{ with .Content }}
  {{- . -}}
{{ end }}
6 Likes