enter image description here

I want to move the 'Did you mean' and 'Related serch terms' section to sidebar in the catalog search Page in Magento 2. currenty that both sections are appeared in 'search results' div. The 'sidebar sidebar-main' is appeared but empty. My layout is 2columns-left. Help me to solve this .


1 Answer 1


div.sidebar.main container responsible for the sidebar sidebar-main div.

Depending on your need, you can create catalogsearch_result_index.xml file in your module or your theme.

  • If you choose put this file in your module, the file path should be: app/code/YourVendor/YourModule/view/frontend/layout/catalogsearch_result_index.xml
  • If you choose put this file in your theme, the file path should be: app/design/frontend/YourThemeVendor/YourTheme/Magento_CatalogSearch/layout/catalogsearch_result_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        <move element="search_suggestions" destination="div.sidebar.main"/>
        <move element="search_recommendations" destination="div.sidebar.main"/>

Remember to clear layout cache type.

  • Thanks it works. Could you tell me . how do you find the element name like "search_suggestions" and "search_recommendations". I have struggled to find out. once again thanks a lot. Jan 2 at 15:39
  • Glad to help you out! Sure. 1st step: search for "Did you mean" in vendor/magento, you will know that these words come from Magento_AdvancedSearch module. 2nd step, as catalogsearch_result_index.xml layout file responsible for the catalog search result page, go to Magento_AdvancedSearch's layout folder (vendor/magento/module-advanced-search/view/frontend/layout) to open catalogsearch_result_index.xml to check blocks. Let me know if you need any further assistance.
    – Tu Van
    Jan 2 at 15:54
  • Great explanation. Thanks . This will really help me a lot for my future development. Jan 2 at 16:44
  • If you like to learn more other parts of Magento 2, you can take a look at my answers in other posts. Most of my answers are explain in details and have step by step instructions, I’m sure you will find it helpful: magento.stackexchange.com/users/39884/…
    – Tu Van
    Jan 2 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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