# Range .Pages by type stopped working?

**URL:** <https://discourse.gohugo.io/t/range-pages-by-type-stopped-working/49863>\
**Category:** support\
**Created:** [May 17, 2024, 2:23pm UTC](https://discourse.gohugo.io/t/range-pages-by-type-stopped-working/49863 "2024-05-17T14:23:03Z")\
**Posts on this page:** 16\
**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:** [May 17, 2024, 2:23pm UTC](https://discourse.gohugo.io/t/range-pages-by-type-stopped-working/49863/1 "2024-05-17T14:23:03Z")

</div>

I’ve upgraded Hugo and suddenly some parts of the website stopped rendering.  
Like this one:

```
	{{ $list := (where .Pages "Type" "td-feature-list") }}
	{{ $len := (len $list) }}
	{{ range $i, $p := $list }}

```

Content for these pages is structured as follows:

```auto
/content
 |-- container-page
     |-- td-feature
         |-- td-intro.de.md

```

with the frontmatter as follows:

```auto
---
title: "Titel"
date: 2017-11-24T14:23:52+01:00
draft: false
headless: true
weight: 1
type: td-feature-list
featured_image: "td-feature-main.png"
color: green
---

Wenn man alle....

```

It was rendering with 0.111.3 but now with 0.126.2 half of the contents of the website is missing.  
Would greatly appreciate any ideas. 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:** [May 17, 2024, 2:25pm UTC](https://discourse.gohugo.io/t/range-pages-by-type-stopped-working/49863/2 "2024-05-17T14:25:45Z")

</div>

> [@popovich](#):
>
> some parts of the website stopped rendering

What does this mean? Are the pages missing on the list page? Are the pages not rendered to disk? Both?

This would be easier to troubleshoot if you were to share your project.

---

<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:** [May 17, 2024, 3:22pm UTC](https://discourse.gohugo.io/t/range-pages-by-type-stopped-working/49863/3 "2024-05-17T15:22:08Z")

</div>

Unfortunately there is no public repository I could share with you.  
This is not even a page, which is not being rendered, but parts of the main pages. The code above is a partial which is being included in a `single.html` of a container page:

```auto
{{ define "navigation" }}
	{{ partial "navigation" . }}
{{ end }}

{{ define "main" }}

	{{ partial "manager-app/hero" . }}
	{{ partial "manager-app/intro" . }}
	{{ partial "manager-app/absences" . }}
	{{ partial "manager-app/tasks" . }} <-- this partial is the code above
	{{ partial "analytics/hero" . }}
	{{ partial "analytics/intro" . }}
	{{ partial "analytics/feature-list" . }}
	{{ partial "team-app/testimonials" . }}
	{{ partial "reviews" . }}
	{{ partial "home/specials" . }}

{{ end }}

```

I can give you more details, if you tell me where I have to look.

---

<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:** [May 17, 2024, 3:27pm UTC](https://discourse.gohugo.io/t/range-pages-by-type-stopped-working/49863/4 "2024-05-17T15:27:00Z")

</div>

> [@popovich](#):
>
> Unfortunately there is no public repository I could share with you.

See [Requesting Help](https://discourse.gohugo.io/t/requesting-help/9132).

> If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

Trying to re-create your setup with limited information is not terribly efficient.

---

<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:** [May 17, 2024, 7:03pm UTC](https://discourse.gohugo.io/t/range-pages-by-type-stopped-working/49863/5 "2024-05-17T19:03:37Z")

</div>

Here is the repo you can look at  
[https://bitbucket.org/bureaug/hugo\_test/src/master/](https://bitbucket.org/bureaug/hugo_test/src/master/)

Specifically

themes/test-theme/layouts/partials/home/solution.html  
themes/test-theme/layouts/partials/container/absences.html  
themes/test-theme/layouts/partials/container/tasks.html  
themes/test-theme/layouts/partials/container/feature-list.html

are not being rendered. I might have jumped couple of updates and am missing a breaking change, maybe? I really appreciate your time and effort. Thanks a lot in advance.

---

<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:** [May 17, 2024, 11:46pm UTC](https://discourse.gohugo.io/t/range-pages-by-type-stopped-working/49863/6 "2024-05-17T23:46:12Z")

</div>

The behavior [changed](https://github.com/gohugoio/hugo/commit/fce8d82b79335394ee9102f5bb449d76a81f808f) in v0.123.6.

The `headless` (boolean) setting in front matter has been functionally superseded by the `build` options.

Setting `headless: true` is equivalent to:

```yaml
build:
  render: never
  list: never

```

But what you probably want, in this case, is:

```yaml
build:
  render: never
  list: always

```

And since the default for `build.list` is `always`, you can do this:

```yaml
build:
  render: never

```

See [https://gohugo.io/content-management/build-options/](https://gohugo.io/content-management/build-options/).

* * *

The above will render the content you want on the home page, but if this were my site I would refactor the headless structure per this example:

[https://gohugo.io/content-management/build-options/#example----headless-section](https://gohugo.io/content-management/build-options/#example----headless-section)

Then in templates such as “themes/test-theme/layouts/partials/home/solution.html” you can do:

```plaintext
{{ $list := (site.GetPage "/some/headless/section").Pages }}

```

The advantages of this approach:

1. Improved organization

2. No need to set “type” in front matter

3. You can cascade the build options down from the section page (\_index.md) instead of setting them on every page

4. You can change the build options to…

---

<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:** [May 19, 2024, 3:30pm UTC](https://discourse.gohugo.io/t/range-pages-by-type-stopped-working/49863/7 "2024-05-19T15:30:04Z")

</div>

Joe, thank you for your time. I’ve pushed to the repo with some changes

- build options, i.e. `content/container/abs-feature/abs-intro.de.md`
- removed headless from frontmatter
- added feature with tags, `content/features/_feature1.de.md`

Alas, it didn’t work as expected. Am I messing it up somewhere else?  
Go 1.22.3  
Hugo 0.126.1  
macOS Monterey 12.7.2

---

<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:** [May 20, 2024, 5:37pm UTC](https://discourse.gohugo.io/t/range-pages-by-type-stopped-working/49863/8 "2024-05-20T17:37:47Z")

</div>

Try this:

```plaintext
git clone --recurse-submodules https://github.com/jmooring/hugo_test
cd hugo_test
hugo server

```

This is the example you should use:  
[https://gohugo.io/content-management/build-options/#example----headless-section](https://gohugo.io/content-management/build-options/#example----headless-section)

We make the entire “home” section headless. Do not include “build” or “headless” settings in front matter.

---

<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:** [May 20, 2024, 5:41pm UTC](https://discourse.gohugo.io/t/range-pages-by-type-stopped-working/49863/9 "2024-05-20T17:41:34Z")

</div>

And this is the commit with all of the changes:  
[https://github.com/jmooring/hugo\_test/commit/8ba7297d50712457eac96d6c0902e89998767eb9](https://github.com/jmooring/hugo_test/commit/8ba7297d50712457eac96d6c0902e89998767eb9)

---

<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:** [May 20, 2024, 6:07pm UTC](https://discourse.gohugo.io/t/range-pages-by-type-stopped-working/49863/10 "2024-05-20T18:07:48Z")

</div>

So do I understand this correctly:

- I have to include `_index.lang.md` to be able to call `(.Site.GetPage(path/to/folder)).Pages`
- I have to remove headless from front matter

?

Also, the question with taxonomies is still unclear. Tags are set in front matter, but the `range .Site.Taxonomies.tags.some_tag` is empty.

---

<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:** [May 20, 2024, 6:09pm UTC](https://discourse.gohugo.io/t/range-pages-by-type-stopped-working/49863/11 "2024-05-20T18:09:39Z")

</div>

> [@popovich](#):
>
> I have to include `_index.lang.md` to be able to call

Yes. Otherwise there’s not a page to get.

> [@popovich](#):
>
> I have to remove headless from front matter

Yes. See example site.

> [@popovich](#):
>
> Also, the question with taxonomies is still unclear.

I’ll have a look at that.

---

<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:** [May 20, 2024, 6:40pm UTC](https://discourse.gohugo.io/t/range-pages-by-type-stopped-working/49863/12 "2024-05-20T18:40:47Z")

</div>

> [@popovich](#):
>
> but the `range .Site.Taxonomies.tags.some_tag` is empty.

There were still three pages with `headless: true` in front matter.

---

<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:** [May 20, 2024, 6:53pm UTC](https://discourse.gohugo.io/t/range-pages-by-type-stopped-working/49863/13 "2024-05-20T18:53:26Z")

</div>

Thank you, Joe! Really appreciate your help.

---

<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:** [May 20, 2024, 7:02pm UTC](https://discourse.gohugo.io/t/range-pages-by-type-stopped-working/49863/14 "2024-05-20T19:02:11Z")

</div>

You’re welcome.

Let me know when I can remove the test repo ([https://github.com/jmooring/hugo\_test](https://github.com/jmooring/hugo_test)).

---

<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:** [May 20, 2024, 9:54pm UTC](https://discourse.gohugo.io/t/range-pages-by-type-stopped-working/49863/15 "2024-05-20T21:54:33Z")

</div>

> [@jmooring](#):
>
> Let me know when I can remove the test repo

Removed.

---

<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:** [May 22, 2024, 9:55pm UTC](https://discourse.gohugo.io/t/range-pages-by-type-stopped-working/49863/16 "2024-05-22T21:55:31Z")

</div>

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