As the title. I've installed a fresh Magento CE 2.1.7
- Opted out from installing sample data (no sample data)
- Luma theme is selected by default (Luma logo appears)
Steps made:
-
Created a subcategory as sub-child of Default Category
-
Made sure both Default Category and subcategory are enabled from
Admin >> Products >> Categories
:Enable Category = Yes
Include in Menu = Yes
-
Display Setting for category
Anchor = Yes
-
Make sure Default Category is selected from
Admin >> Stores >> All Stores >> Main Website Store
Root Category = Default Category (selected from the drop-down)
-
I ran the following commands to clean cache and reindex:
php bin/magento indexer:reindex; rm -R pub/static/*; rm -R var/view_preprocessed/*; php bin/magento cache:flush; php bin/magento cache:clean;
- Purged and disabled Varnish cache on the server level
- Restarted Apache
- Upgraded Magento CE from 2.1.7 to 2.1.9
Expected result:
- To see top navigation menu in all pages
Actual results (menu shows on all pages except home page):
- Top navigation menu does not appear on Home Page
Picture 1. Homepage. Menu not showing:
- Top navigation menu, however, appears correctly on other pages such as
Customer Login
andCreate New Customer Account
pages
Picture 2. Create a new customer account page. The menu is showing:
I feel like I'm missing something obvious just under my nose.
How to display the top navigation menu on the home page?
Best Answer
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.
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.