Jump to content

Remove Header/Footer from Search Page

Go to solution Solved by tuanphan,

Recommended Posts

I am trying to remove the header and footer from the search page. Because the search page is generated by Squarespace I cannot go into the page settings and remove the header/footer with code injection. Also, there is no collection to target in css. I have tried

           .sqs-search-page {header {display:none!important;} in CSS, but it did not work.

Any help would be appreciated.

Link to comment
  • Replies 2
  • Views 1.1k
  • Created
  • Last Reply

Top Posters In This Topic

  • Solution

First, you need to add this to Website > Website Tools > Code Injection > Footer (do not add to Custom CSS)

 <script>
if (document.location.pathname.indexOf("/search") == 0) {
    document.querySelector('body').classList.add('t-search')
}
  </script>

Next, add this code to Custom CSS box

body.t-search {
	header#header, footer.sections {display: none !important;}
}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.