Menu works locally, but array empty when deployed

Hello there, I need some help deploying my website (I am a bit of noob in hugo, sry!). I use netlify and github for continuous deployment. I have a website that is working locally, but when i deploy it, the items in the main menu don’t show up.

I am using a partial called “nav” that contains the menu

landing page:

<!DOCTYPE html>
<html lang="en" dir="ltr">
  {{ partial "head" . }}
    <div id="landing-page-menu">
        {{ partial "nav" . }}

partial “nav”:

  {{ range .Site.Menus.main.ByWeight }}
  <li><a href="{{ .URL }}" onmouseover="changeText({{ .Title }},this)" onmouseout="changeText({{ .Params.Glyphs }}, this)">{{ .Params.Glyphs }}</a></li>
  {{ end }}

there should be three items in this menu, their front matter looks like this:

title: "About"
glyphs: "⁆⁖⁕→͡"
date: 2021-07-13T15:36:36+02:00
draft: true
hasimg: true
img: "/assets/about/about.png"
    weight: 2
      glyphs: "⁆⁖⁕→͡"

you can ignore the glyph parameter, it’s used for a specific hover effect that should be unrelated.


Which version of Hugo are you running locally?
Which version of Hugo are you running on Netlify?
Is this a multilingual site?

Hi, I am using hugo version 0.85.0 locally and i just set up the netlify environment variable to 0.85.0 to make sure to match it, I hadn’t thought about that :slight_smile: sadly, it’s still not working.
Also, the site is not multilingual.

Are the glyphs valid unicode? Also I don’t see a closing quotation on the glyph. I know you think they are unrelated, but I suspect a unicode issue.
What do the Netlify deploy logs show?

Also, does the menu work if you deploy without the glyph (for testing you could use a branch deploy)?

I just noticed this:

draft: true

I suspect you are running hugo locally with either the -D or --buildDrafts option.
And on the server you are not.


I was able to solve the issue. First, yes I had to use the hugo -D command to build because all my sites were drafts and secondly, there was an error on one of the linked pages, which I somehow missed. The error happened trying to read out a folder using readDir and I was using the wrong directory.
Thank you so much for your help!

1 Like