The index.html doesn't fill with content

Hello,

I’m trying to populate the index.html page with project content.

This is the layouts/index.html.

{{ define "main" }}
  <div role="main" class="container">
    <div class="portfolio-list">
      {{ $paginator := .Paginate (where .Data.Pages "Type" "project") }}
      {{ range $paginator.Pages }}
          {{ partial "portfolio_piece.html" . }}
      {{ end }}
    </div>
    {{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }}
      <ul class="pager main-pager">
        {{ if .Paginator.HasPrev }}
          <li class="previous">
            <a href="{{ .URL }}page/{{ .Paginator.Prev.PageNumber }}">&larr; {{ i18n "newerPosts" }}</a>
          </li>
        {{ end }}
        {{ if .Paginator.HasNext }}
          <li class="next">
            <a href="{{ .URL }}page/{{ .Paginator.Next.PageNumber }}">{{ i18n "olderPosts" }} &rarr;</a>
          </li>
        {{ end }}
      </ul>
    {{ end }}
  </div>
{{ end }}

It should list the projects in the content folder.

Here is the folder structure:

├── content
│  ├── _index.md
│  ├── page
│  │  └── about.md
│  ├── post
│  │  ├── proj01.md
│  │  ├── proj02.md
│  │  ├── proj03.md
│  │  └── proj04.md
│  └── project
│     ├── proj01.md
│     ├── proj02.md
│     ├── proj03.md
│     └── proj04.md

The problem is that the generated index doesn’t list projects. Hugo does generate a post folder and project folder. What i want is to have the contents of the project/index.html in the main index.html. It did work at some point… it stopped at some point, which I assume happened because of changes in Hugo - not sure on which version.

Instead of

.Data.Pages

Try

site.RegularPages

Thank you. That worked. Could you point me in a direction where I can find the explanation for what happened here? I would like to understand why did it fail with .Data.Pages.

Thank you again :slight_smile:

Good deal. See this GitHub issue for some history: https://github.com/gohugoio/hugoThemes/issues/682