Making code conditional

I came across this code and I have a use case for my site. How would I wrap it in a conditional so it only shows where it is needed? It works, except the heading “comments” shows up in all posts.

  • Remove headline line 1.

  • After line

{{ $filtered := where .Site.Pages "Params.parent" $url.Path }}

add

{{- if $filtered -}}
<h1>comments</h1>
{{- end -}}

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.