Running Hugo with same content generates different pages?


I’m becoming crazy. I have the following content layout (content root is postazione-sponsor)

My Homepage has three buttons, each going to a different section (pardon the ugly names, it was an experiment with plurals). cultures, grandprixes and terraces.

When I click, say, terraces, I’d like to have a listing of the terraces in my subfolder: Barcelona, Bruxelles and so on. Each subfolder has an

title: "Bruxelles"
title_eng: "Bruxells"
country: "Belgio"
country_eng: "Belgium"
taxonomy: "terraces"
weight: "3"
thumbnail: "bruxelles-terrace.jpg"

Most of the times, it works. But sometimes, without changing anything (or at least anything that I am aware of), what I get is not a list of cities, but a list of pages, specifically (under introduction) then… up till the end of the pages inside the subfolders under terraces.
This keeps happening to a random section, and moreover I have a seeming correct behaviour when running hugo server, but usually it’s wrong when I run hugo and generate the actual static pages.

At each run of hugo/hugo section I experience this strange and undesired behaviour on a random section (I have 3), but not every one…

Hugo version is Hugo Static Site Generator v0.40.3 darwin/amd64 BuildDate: (no build date…)
On Mac OSX High Sierra

A typical item file is like this

taxonomy:  "terraces" 
terraces: ["Introduzione"]
weight: 1
year: "1948-1965"
category: "TERRAZZA M"
area: "Introduzione"
area_eng: "Introduction"
title: "Le otto Terrazze   nel mondo nel 1965  -  The eight Terrazze   throughout the world in 1965 "
title_short: "Introduzione - Introduction"
artist: ""
artist_short: ""
caption_it: "Le Terrazze ... . "
caption_en: "The  ...s."
thumbnail: "globomar.jpg"
image: "globomar.jpg"
audio: ""
audio_duration: 0
zoom: "0"

and this is my config.toml

baseURL = "/"
languageCode = "IT-it"
title = "Postazione Sponsor"
theme = "postazione-sponsor"

# Pagination
paginate = 6
paginatePath = "page"

  # when on a normal page
  idleTimeout = 60 # 60

  terrace = "terraces"
  culture = "cultures"
  grandprix = "grandprixes"

    name = "terrace"
    title = "terrazze2"
    identifier = "terrace3"
    weight = 1
    url = "/terraces"

 ..others menu skipped

I sotrngly suspect it’s a problem between Sections and Taxonomies. Subdirs are sections, but somehow they get mixed with the taxonomies with the same name.

Lastly this is the offending template (layouts/_default/terms.html)

{{ define "main" }}
            {{ $list := .Paginator.Pages }}
            {{ $len := (len $list) }}
            {{range $index, $element := $list}}
            <div class="col-md-4 card-video-wrap">
                <a href="{{ .Permalink }}">
                    <div class="card-video text-center">
                        <img src="{{ .Site.BaseURL }}img/{{.Params.Taxonomy}}/thumb/{{.Params.Thumbnail}}">
                    <div class="card-title">
                              <h5>{{ .Title }}</h5>
                            <h5 class="dimmed">{{ .Params.Title_eng }}</h5> 
            {{ end }} 
        {{ partial "pagination.html" . }}
{{ end }}

Any help? I am missing something fundamental here I suspect.


At the moment I’ve solved by:

  • ditching taxonomies, in fact contents are organized by sections.
  • using sections and a section template
  • adding some front-matter to the in each subsection
title: "Barcellona"
title_eng: "Barcelona"
country: "Spagna"
country_eng: "Spain"
level: "1"
layout: "list"
weight: "2"
thumbnail: "barcello.jpg"

while my section template is like this…

{{ $paginator := .Paginate (where (where .Site.Pages "Section" .Section) ".Params.level" "==" "1") }}
 {{ $list := $paginator.Pages }}
            {{range $index, $element := $list}}

The double where is to get only pages in given section (nothing was shown by `.Paginator.Pages`, and not going too deeply. Just the `` file displayed. Maybe my contet should be organized differently..

By forcing to use `list.html` as a template of subsections, I have the correct listing of pages under a subsection.

It's a bit crooked.. I know..