HUGO

Create Custom Lists/Pages which are not Posts, Sections, Taxonomies

My font matter has a variable called “featured” which is a boolean.

I am trying to create a custom page which lists with all pages which are featured.

This is not a post, section, taxonomy. how can a custom page be created?

1 Like
  • Create a regular page at content/featured-page.md or wherever. This will render a page at yoursite.com/featured-page/.
  • Set front matter layout: custom-layout. This will look for a custom template layout called custom-layout.html instead of using the default single.html.
  • Create template at layouts/_default/custom-layout.html. This is the layout template file that the page above will use to output the page.
3 Likes

Another question. How do I find all the pages which have featured set to true?

Use where:

{{ range where .Site.RegularPages ".Params.featured" true }}
2 Likes