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: https://thedivtagguy.netlify.app/

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: https://github.com/thedivtagguy/website2 if this helps.

What can I do to fix this?

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

# googleAnalytics: UA-123-45

minify:
    disableXML: true
    # minifyOutput: true

languages:
    en:
        languageName: "English"
        weight: 1
        menu:
            main:
                - 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
   
outputs:
    home:
        - HTML
        - RSS
        - JSON

params:
    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>'

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

    homeInfoParams:
        Title: "A Whole Sort of General Mishmash"
        Content: >
           Art and Code by Aman Bhargava
    socialIcons:
        - name: twitter
          url: "https://twitter.com/thedivtagguy"
        - name: instagram
          url: "https://instagram.com/thedivtagguy"
        - name: github
          url: "https://github.com/thedivtagguy"
        - name: stackoverflow
          url: "https://stackoverflow.com/users/14425671/aman"
taxonomies:
    category: categories
    tag: tags
    series: series

privacy:
    vimeo:
        disabled: false
        simple: true

    twitter:
        disabled: false
        enableDNT: true
        simple: true

    instagram:
        disabled: false
        simple: true

    youtube:
        disabled: false
        privacyEnhanced: true

services:
    instagram:
        disableInlineCSS: true
    twitter:
        disableInlineCSS: true

Hello,

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):

    mainSections:
        - 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:
    /themes/hugo-PaperMod/layouts/_default/list.html

  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.