5

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

enter image description here

  • 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:

enter image description here

  • Top navigation menu, however, appears correctly on other pages such as Customer Login and Create New Customer Account pages

Picture 2. Create a new customer account page. The menu is showing: enter image description here


I feel like I'm missing something obvious just under my nose.

How to display the top navigation menu on the home page?

7

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.

  • Thanks @mohammed joraid – NIPPU May 20 at 14:18
2

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.

  • Thank you for sharing. This is indeed adding more explanation to the issue. – Mohammed Joraid Jan 14 at 12:59
0

please try these commands

  php bin/magento setup:static-content:deploy
  php bin/magento cache:clean
  • Thank you for your answer. I just tried your suggestion. Sadly did still the same result. The menu appears on other pages but not home page. – Mohammed Joraid Sep 26 '17 at 5:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.