Lists of mainSections render empty

This was working fine till yesterday, but today I ran it on the hugo-server and the homepage has become completely blank:

This is also the case with the archives page. You can see the live deploy here:

The only modifications I’ve made since last night is adding a new content-type, projects and copying the contents of list.html for posts into a new layout. The theme layouts themselves haven’t been modified. The contents of my config.yaml are as follows:

I’ve uploaded my website to this repo: if this helps.

What can I do to fix this?

baseURL: ""
title: "thedivtagguy"
paginate: 8
theme: ["hugo-PaperMod", "hugo-shortcode-gallery"]
enableInlineShortcodes: true
enableRobotsTXT: true
label.icon: true

# googleAnalytics: UA-123-45

    disableXML: true
    # minifyOutput: true

        languageName: "English"
        weight: 1
                - name: Blog
                  url: archive
                  weight: 5
                - name: Search
                  url: search/
                  weight: 10
                - name: Tags
                  url: tags/
                  weight: 10
                - name: Photography
                  url: photography/
                  weight: 6
                - name: Projects
                  url: /projects
                  weight: 7
        - HTML
        - RSS
        - JSON

    env: production
    description: "Aman Bhargava | Visual Artist"
    author: Aman Bhargava
    # author: ["Me", "You"] # multiple authors
    ShowReadingTime: true
    defaultTheme: auto
    ShowShareButtons: true
    displayFullLangName: true
    # images: ""
    # assets:
    #   favicon: '<path / external url>'

        enabled: false
        title: PaperMod
        imageUrl: "#"
        imageTitle: my image
        # imageWidth: 120
        # imageHeight: 120
            - name: Archives
              url: archives
            - name: Tags
              url: tags

        Title: "A Whole Sort of General Mishmash"
        Content: >
           Art and Code by Aman Bhargava
        - name: twitter
          url: ""
        - name: instagram
          url: ""
        - name: github
          url: ""
        - name: stackoverflow
          url: ""
    category: categories
    tag: tags
    series: series

        disabled: false
        simple: true

        disabled: false
        enableDNT: true
        simple: true

        disabled: false
        simple: true

        disabled: false
        privacyEnhanced: true

        disableInlineCSS: true
        disableInlineCSS: true


I confirm the issue. I only had a cursory look and your setup does appear to be slightly complex.

As per the documentation about mainSections

If the user has not set this config parameter in their site config, it will default to the section with the most pages .

In your project the mainSections list renders empty, for reasons that I do not have the time to look for.

However you can fix the issue by manually defining the mainSections array.
In line 55 of your project’s config enter the following (or in whatever order you need):

        - projects
        - photography
        - post
1 Like

Thank you so much for your response, your code fixed this issue!

I have three further questions.

  1. Is this usually caused by the theme or something I might have inadvertently done? If so, I might consider submitting a bug report to the theme’s author.

  2. Should I be adding new content types to this array every time I create new ones? These appear to be just the name of the subdirectories in the content folder, so in the future should I just add those to the list?

  3. Why should this be added in line 55 specifically?

  1. Not sure. mainSections is an internal method. Hugo detects the Sections with the most pages. It appears that the theme uses several conditions to generate the originally missing lists.
    The template that controls the homepage, from what I’ve seen, is located at:

  2. Yes. If you want to display these in the mainSections lists you will need to add them.

1 Like

I just saw the above question.

mainSections belongs in the params table of the config, line 55 is the line after said table, therefore that is the proper place to set the mainSections array.

1 Like

I checked after you had replied earlier and understood why. Should have posted here. Thank you so much for your help!

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