Magento 2: Top Nav Menu is not appearing in Home Page

After following major tutorials and troubleshooting web pages it turned out the issue lies with my hosting configuration.

Varnish Cache seems to be the cause of the menu disappearing. Disabling Varnish causes the menu to not show.

The solution is to enable Varnish Cache and the menu appeared again which is kinda bizarre for me and hard to understand.

enter image description here

Update:

It turns out there were different Vanish Cache on/off switches and I had them mixed up on/off.

-The first Varnish cache control I have is the main switch at the server level (from the interface of my hosting panel).

-The second one for application level (also from the interface of my hosting panel), which allows me to control enabling Varnish for individual applications on the server, rather than the whole server like in the main switch.

-The third one is from within Magento Admin (Magento 2 admin panel - configuration page).

I had my settings mixed up. (I cannot really remember by the time of writing this update) I think I had my Magento application Varnish settings enabled from Admin but disabled from the server or the application level.

Now if I want to use Varnish I make sure all settings are aligned. Switched on from top to bottom (server level to Magento level) and switch off from bottom to top.


Take a look to this issue:

https://github.com/magento/magento2/issues/3421

Summary:

In some cases when Varnish Cache is activated, due to a Magento 2 and Varnish issue, the navigation menu can disappear.

In order to solve this Magento issue, you can remove the TTL attribute (remove ttl="3600") from /vendor/magento/module-theme/view/frontend/layout/default.xml, and the navigation menu will appear.