# List child pages grouped by custom parameter

**URL:** <https://discourse.gohugo.io/t/list-child-pages-grouped-by-custom-parameter/43559>\
**Category:** support\
**Tags:** taxonomy\
**Created:** [March 22, 2023, 1:14pm UTC](https://discourse.gohugo.io/t/list-child-pages-grouped-by-custom-parameter/43559 "2023-03-22T13:14:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![popovich](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@popovich](https://discourse.gohugo.io/u/popovich)\
**Post date:** [March 22, 2023, 1:14pm UTC](https://discourse.gohugo.io/t/list-child-pages-grouped-by-custom-parameter/43559/1 "2023-03-22T13:14:32Z")

</div>

I am kinda stuck by seemingly trivial problem.  
Here is the directory structure I have:  
 ![Screenshot 2023-03-22 at 14.08.59](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/1/d/1d3f331598ce7dd668f25c6a71ffffdf7292d474.png)

**Every** page within “pages” folder has the same structure:

```auto
---
title: "Title"
subtitle: "Subtitle"
keywords: ""
description: ""
date: 2023-03-14T11:28:43+01:00
draft: false
layout: article
year: 2021
url: some/deep/url
---

<div>I need to use some html here</div>

```

In the template, which is correctly being called for the \_index.md files I have the following range loop:

```auto
			{{- range (.Pages.GroupByParam "year").Reverse -}}
			<div class="col-12 col-md-6 col-lg-4 card-item rate-list">
				<h2>{{ .Key }}</h2>
				<ul>
					{{- range .Pages.ByTitle -}}
					<li><a href="{{ .Permalink }}">{{ .Params.subtitle | markdownify }}</a></li>
					{{ end }}
				</ul>
			</div>
			{{ end }}

```

It seems like everything is supposed to be ok but it’s not. When building, I get the following error:

```auto
executing "partials/biz-days/list.html" at <.Data.Pages.GroupByParam>: error calling GroupByParam: there is no such a param

```

but there is! In every page under “pages” folder! What am I missing here?..

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [March 22, 2023, 1:45pm UTC](https://discourse.gohugo.io/t/list-child-pages-grouped-by-custom-parameter/43559/2 "2023-03-22T13:45:35Z")

</div>

> [@popovich](#):
>
> `{{- range (.Pages.GroupByParam "year").Reverse -}}`

I think that .Pages includes more than what you think. There’s something odd going on here, but for now I suggest you be more specific with the page collection. For example:

`{{- range (.RegularPages.GroupByParam "year").Reverse -}}`

OR

`{{ range (where site.RegularPages "Type" "posts").GroupByParam "year" }}`

---

<div class="post-metadata">

**Author:** ![popovich](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@popovich](https://discourse.gohugo.io/u/popovich)\
**Post date:** [March 22, 2023, 1:52pm UTC](https://discourse.gohugo.io/t/list-child-pages-grouped-by-custom-parameter/43559/3 "2023-03-22T13:52:40Z")

</div>

.RegularPages did the trick, thanks!

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [March 22, 2023, 2:07pm UTC](https://discourse.gohugo.io/t/list-child-pages-grouped-by-custom-parameter/43559/4 "2023-03-22T14:07:17Z")

</div>

> [@jmooring](#):
>
> There’s something odd going on here

This is incorrect; behavior is expected.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [March 24, 2023, 2:08pm UTC](https://discourse.gohugo.io/t/list-child-pages-grouped-by-custom-parameter/43559/5 "2023-03-24T14:08:06Z")

</div>

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