Custom output for list page (_index.html) is not working

I’m using Hugo to build static pages for a django site.

To populate the meta description tag, I’ve added a custom “description” type which outputs a txt file. In config.toml I’ve added:

[outputFormats]
  [outputFormats.description]
    baseName = "description"
    isHTML = true
    path = 'meta/description'
    mediaType = "text/plain"

[outputs]
  page = ["HTML", "description"]

Then in my layout/_default/ folder I’ve added two extra templates, to correspond to the existing list.html and single.html:

list.txt and single.txt, both of which contain:

{{.Description | safeHTML }}

The files from single.txt are created as expected, however the list.txt pages don’t seem to work.

The last time this topic was raised, this github issue was linked to:

However, as far as I can see from reading it, it doesn’t have anything to do with custom templates.

I was able to find a workaround for this. I added a custom type and layout for list pages, now in each list page I’ve added this to my front matter:

type: listCustomType
layout: listCustomLayout

And I’ve added the file layouts/listCustomType/listCustomLayout.html.

listCustomLayout.html looks like this:

{{define "main"}}
  // everything from layouts/_default/list.html copied here
{{ end }}

And it works! The custom type is generated as expected.

EDIT: oops, I spoke too soon! I’m getting errors:

error calling Paginate: Paginators not supported for pages of type "page". So I guess this workaround will not work after all.