Post #4 is the one that worked for me, and it worked with .Params, whereas for some reason the above examples with isset
did not work. I had a variable in the front matter called “section_numbe
r” and it was set to ""
in some cases and e.g. “1.2
” in others. Using the following code, it was showing “: Title
” instead of just “Title
” using isset
. Once I switched it then stopped showing the colon.
{{ if .Params.section_number }}
<li><a class="section-jump" href="#{{.Params.weight}}">{{ .Params.section_number }}: {{ .Title }}</a></li>
{{ else }}
<li><a class="section-jump" href="#{{.Params.weight}}">{{ .Title }}</a></li>
{{ end }}