Separate list view of section

I have a section for products that I want to provide a different tabular view for. The main list for this section is in:

layouts/
… products/
… list.html

But I want to create a page that renders a more detailed list using Params from front matter for the section contents in a comparison table. I haven’t figured out how to do this. I thought maybe I could create a top level page and then point to a layout that uses {{ render where .Pages “Section” “products” }} but that doesn’t seem the way to do it.

Could someone steer me in the right direction? Thanks.

Hi there,

I’m not really sure I understand what you are trying to do here, do you have a repo we can have a look at?

So you have a products section yoursite.com/products/ where you have a tabular view, and you want another page at yoursite.com/products-alt/ that uses a different layout?

If that is what you are trying to do: the .Pages in /products-alt/ will probably be empty as it does not actually have the children products; these are in /products/.

Instead do something like:

{{ $products := where site.RegularPages "Section" "products" }}
{{ range $products }}
2 Likes

Thanks! This is exactly what I was looking for. I wasn’t finding the way to run the range outside of the normal section list. Works perfectly!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.