HUGO

Blog menu rendering inconsistently

Hi Hugo community,

I’ve been re-building my portfolio site: https://www.santoroland.com/
Amongst many changes I wanted to update the menu system from the lazy blogger menu which required me to add the years into the site config:
Menu Templates | Hugo
To the ‘more advanced’ one which in theory would only require menus to be defined in the posts front matter:
Menu Templates | Hugo

The issue I am getting is that the menu is rendering inconstantly on the dev server:

As you can see, years and posts get repeated. This happens most of the time when after the dev server builds the site…and then changes randomly sometimes on content updates or site refreshes.


Here is an example front matter

title: "Bladerunner 2049"
draft: false
date: 2017-12-29T14:49:13-04:00
showonlyimage: false
image: "img/work/bladerunner2049/bladerunner2049_header.jpg"
tags: ["VFX","film",'bladerunner2049','bladerunner','nuke','compositing']
summary: "Breakdown of sequences lead for the 2017 film Bladerunner 2049."
menu:
  work:
    parent: '2017'
    weight: 20171225
    name: "Bladerunner 2049"

And then the code used to read the site menu into the sidebar:

<!-- work menu start-->
<ul>
   {{ $currentPage := . }}
   {{ range .Site.Menus.work.Sort.Reverse }}
      {{ if .HasChildren }}
         <li>
            <a class="s-sidebar-nav-link" href="">
               {{ .Name }}
            </a>
            <ul>
               {{ range .Children }}
                  <li {{if $currentPage.IsMenuCurrent "main" . }} class="active"{{end}}>
                     <a class="s-sidebar-nav-link" href="{{.URL}}">{{ .Weight }} - {{ .Title }}</a>
                  </li>
               {{ end }}
            </ul>
      {{ end }}
   {{end}}
</ul>

Here is a link to the git repo.
https://github.com/santororock/santoroland.com

One more thing to note, is that while the hugo dev server is running, if I re-save any of the content.md files, the menu will often begin rendering correctly once more.
Isn’t that weird?!

Am I missing something super obvious?

Thanks!
-Luigi

Your repository https://github.com/santororock/santoroland.com is unreachable. Perhaps it is private?

You were correct sir! The github project was in fact private. Should be public now:)
-Luigi

I cannot build your site.

Error: Error building site: “/home/jmooring/temp/santoroland.com/content/work/cgi.md:18:1”: failed to render shortcode “image”: failed to process shortcode: “/home/jmooring/temp/santoroland.com/themes/portfolio_lite/layouts/shortcodes/image.html:7:18”: execute of template failed: template: shortcodes/image.html:7:18: executing “shortcodes/image.html” at <imageConfig (printf “/static/%s” $src)>: error calling imageConfig: open /home/jmooring/temp/santoroland.com/static/img/work/cgi/cgi_title_graphic.jpg: no such file or directory

Gotcha. That makes sense. I recall now after seeing your error, at some point actively excluding image via a .gitignore file as they brought the project over 4gb.
I’ll spend some time to develop a mechanism to have the site build without the images:)

Thanks for trying that repo!
I’ll report back when there is a new one working without images!
Sincerely,
-Luigi

I updated the site to build without the images, and pushed the git repo:
Let me know if it builds for you?

Your site builds without errors, but I am unable to replicate the problem you reported. The menu does not have any duplicate entries. I have tried repeatedly starting/stopping hugo server, modifying content or layouts while hugo server is running, etc.