Changing menu entries depending on current page?

Hello,

I’m having some issues with my menu items using the Doks theme. Sometimes, depending on the current page I’m on, the menu items are not updating. I’m seeing this issue on my localhost and deployed site. For example, the first image shows my sidebar when I first visit my site. This is an outdated sidebar entry. If I click on one of the links lower in the sidebar, the menu items change. I’m having the same issue with my main menu at the top of the page, as well. Any ideas?

(Edit: I think my question may be a bit confusing. Essentially, my updates aren’t always showing on my deployed site/localhost and seem to be somehow linked to the page I’m currently on.)


It will probably help to know what the frontmatter on “the page that shows outdated entries” and “the page that was/is Integrity” looks like. Also if you build that menu based on a menu configuration that one would help.

Also, a list to check:

  • wherever you deploy your site to is cleaned out before new content is uploaded
  • you restarted hugo server between changing your content and the menu remembering old entries

cc: @h-enk

I suspect you have the same weight set more than once in the frontmatter of your pages. Your repo?

1 Like

If I open the site on localhost and go to this page (frontmatter shown) the entries are outdated. Some pages I click away to and the sidebar entries remain the same (outdated), but others will update the sidebar. Also, the page “integrity” has been deleted completely from my file directory, yet still shows up.

Here is my deployment link. https://poetic-lollipop-11499b.netlify.app/ If you click “Playbook” in the top menu, the “old” sidebar is shown. From there, if you click “test” under the 4. Research Materials heading, the sidebar updates while you are on that page. However, if you go back to the homepage and then “Playbook” again, the changes revert.

Clear your cache running something like:

npx shx rm -rf public resources .hugo_build.lock

Take a look at how I set the weight in the pages of the content directory — make weight unique

That will do the trick — see (temporary) demo site

@h-enk Thanks for your help. When you say "Clear your cache running something like: … " do I do that from command line in my root directory?

Also, thanks for your help with assigning unique weights—that makes perfect sense.

Finally, when I check the temporary demo site, everything looks great but when I click away from the page and then try to get back to the “Playbook” the page is not found—do I need to worry about that?

@h-enk Thanks for your help. When you say "Clear your cache running something like: … " do I do that from command line in my root directory?

That’s correct (project root directory)!

Finally, when I check the temporary demo site, everything looks great but when I click away from the page and then try to get back to the “Playbook” the page is not found—do I need to worry about that?

The main menu entry links to: /docs/introduction/getting-started/, but the page lives at /docs/1_introduction/getting-started/. So, update your main menu entry, or the page slug.

Thank you!!!