I’ve had a great deal of good luck with Hugo and things are going well. However, I have a new need and it’s vexing me a bit. I suspect that there’s a very (very!) easy way to do this but it is not at all clear to me. I appreciate any help.
In list.html, I restrict the list function to certain categories and types:
(or (eq .Section "post")
(eq .Section "needhelp")
(eq .Section "buildingbetter")
(eq .Section "anxiety")
(eq .Section "stress")
(eq .Section "depression")
(eq .Section "mentalhealth")
(eq .Section "news")
(eq .Section "authors")
(eq .Section "categories")
(eq .Section "tags")
(eq .Section "topics")
)
What I’m trying to do now is to omit posts that have a layout type of “home”. Hugo actually excepts this format but it doesn’t exclude the posts I want to omit. Here’s a sample post that should be omitted:
HOME.MD:
---
title: "Authors Home"
date: 2020-01-05T11:07:10+06:00
description: "Articles and news related to the site authors."
draft: false
image_name: "taxonomy"
description: "this is meta description"
draft: false
layout: "home"
---
And here’s the logic from list.html that does not work:
{{ define "main" }}
{{ if or (eq .Section "categories") (eq .Section "tags") (eq .Section "topics") }}
{{ partial "taxonomy-page-title.html" . }}
{{ else -}}
{{ partial "page-title.html" . }}
{{- end }}
<!-- checking blog -->
{{ if
(and
(or (eq .Section "post")
(eq .Section "needhelp")
(eq .Section "buildingbetter")
(eq .Section "anxiety")
(eq .Section "stress")
(eq .Section "depression")
(eq .Section "mentalhealth")
(eq .Section "news")
(eq .Section "authors")
(eq .Section "categories")
(eq .Section "tags")
(eq .Section "topics")
)
(ne .Params.Layout "home")
)
}}
… followed by the rest of the list html, which works just fine.
Thanks for any assistance.
Brian