Conditional for specific tag

I’m trying to create an ‘if’ that is applied only when the post has a specific tag (‘notes’ in this case). Latest attempt was to use if in .Params.tags "notes" but all I am accomplishing with this is to apply the conditional to almost all posts, regardless the tag.

So if I have some posts with the ‘notes’ tag, how do I properly refer to them?

1 Like

Try “with”, which is like “if”, but it will not fail when something is not set.

using ‘with’ I get an error

"tags is not a method but has arguments"

Found correct syntax:

‘if in.Params.tags “notes”’

Thanks to…

1 Like

On my blog I render the first three post as summery and the rest as link list.

{{ range first 3 (where .Data.Pages "Type" "post") -}}
{{ .Render "summary" }}
{{ end -}}

{{ range after 3 (where .Data.Pages "Type" "post") -}}
{{ .Render "li" }}
{{ end -}}
1 Like