Meta description lists and static pages

I have a problem that drives me slightly nutters. I have a partial called head.html that generates meta description:

<meta name="description" content="{{if .IsHome}}{{ .Site.Params.description }}{{else}}{{ .Description }}{{end}}" />

This works for homepage and contentpages. My question is if anyone has a smart solution for adding meta description to lists and custom top level html-pages?

One slightly unclean solution would be to remove meta description from head.html and then creating multiple “subhead”-partials (one for every list and top level html-page).

1 Like

You can try variations of this:

{{ if and (not .IsHome) .IsNode (not .IsPage) }}{{ .Site.Params.description }} ...

Should give you all the “list pages” excluding the home page … But with one argument more than needed, just to show you the options.

2 Likes

Thanks @bep!