Using an older ssg I found a way to prevent something from showing up but I have the wrong syntax. Here is the area of concern. This is list.html template and shows all posts.
{{ define "body" }}
{{ if .IsFiltered }}
</br><h2>Topics: {{ .FilteredTag.Name }}</h2>
{{ else }}
</br><h2>All posts</h2>
{{ end }}
<div class ="list">
{{ range .Posts }}
<a href="{{ .ID }}.html">{{ .Title }} </a> {{ .Time.Format "2006-1-2" }}<br/>
{{ end }}
</div>
{{ end }}
I need to add something similar to the following to prevent the "about" post from showing -
{{ if ne {{ .Title }} "about" }}
If I add it like this, I get an error -
{{ define "body" }}
{{ if .IsFiltered }}
</br><h2>Topics: {{ .FilteredTag.Name }}</h2>
{{ else }}
</br><h2>All posts</h2>
{{ end }}
<div class ="list">
{{ range .Posts }}{{ if ne {{ .Title }} "about" }}
<a href="{{ .ID }}.html">{{ .Title }} </a> {{ .Time.Format "2006-1-2" }}<br/>
{{ end }}
</div>
{{ end }}
Can you see what's wrong? My error states "unexpected {"
You need to write down your condition as follows:
{{ if ne .Title "about" }}
{{ end }}