List view params, where are they?

I’m looking at a list.html and I see .Params.cover AND .Site.Params.cover

I’m setting .Site.Params.cover inside config.toml but where do .Params.cover come from? Basically I want to set the cover image for a list view.


If I understand correctly, the .Params.cover will be from the frontmatter of whatever content is being accessed at that point

Hi mikeaja,

So my question is where do we define the frontmatter for the list view.

The list node has no front matter. This is a known limitation. If you are seeing .Params.cover in a list.html template, I’m assuming that it’s inside of a range of pages. The context changes inside of the range loop.

I see this in Casper theme: It is not inside a loop. It is for the list view cover image:

{{if .Params.cover}}
	<header class="main-header tag-head" style="background-image: url({{ $baseurl }}{{.Params.cover}})">
{{else if .Site.Params.cover}}
	<header class="main-header tag-head" style="background-image: url({{ $baseurl }}{{.Site.Params.cover}})">
	<header class="main-header tag-head no-cover">

So how can I feed it Params.cover for specifix list view?
Thanks moorereason,

You can’t use .Params.cover in a list/node view. That’s a bug in Casper.

What you have to do is keep the section covers in a separate area, like the Site params or in a data file. Lookup the section name in that outside data structure. For an example, check the layouts/partials/li.html template in Casper to see how they lookup author data.

Just to add,. front matter (.params) need a content file and inherently list.html is not one piece of content (in Hugo terms, a node). So there is no place to put frontmatter. I wouldn’t say a llist view not having params is a limitation (where would they go?), more that the approach to node / pages needs clarification (which is happening in another thread already).

My guess is, in Casper, the intention was that this piece of code was going to be within a range, where there could be a single content file accessed but the plan changed

It’s very much a limitation. At the simplest level, it would be nice to be able to set a .Title for a section list.

We’ve talked about it and thrown some ideas around about how we handle content, but the right solution will require a significant effort to implement.

Fair enough. I just meant as things stand, a list is a list, it inherently does not have a base or linked content file. If everything becomes a page, we may have people asking how to create list not linked to content