Jump to content

Troubleshooting - Header Code Injection Carries Over Between Page Loads?

Recommended Posts


I'm working on doing some refreshes to an existing 7.0 site, so I made a copy to test some things out on. You can find it at: https://clownfish-manatee-ngnn.squarespace.com/ password: mhf

On the Dahlia Tubers / Dahlia Shop page I added the following code in header code injection to 1) insert a custom header that was different from the rest of the site 2) hide some header elements and 3) add a border and shadow to the body of the page. (Forgive the inline styles, while I assigned a class I did not add any CSS here as this was a quick mockup). 

<div class="custom-header" style="width: 100%; text-align: center; 
  background-color: #4a574b; color: white; 
  vertical-align: center; line-height: .5em;">
  <p>Morey Hill Farm</p>
  <h1 style="color: white;">DAHLIA SHOP</h1>
  <p style="padding-bottom: 20px;"><a href="/home">Return to Main Site</a> | <a href="/cart">Cart</a></p></div>

<style>.Header-inner, .mobile-bar  {
display: none !important;

  .Main {padding-top: 0px; border-radius: 10px;
  -webkit-box-shadow: 3px 4px 2px 0px rgba(0,0,0,0.45);
-moz-box-shadow: 3px 4px 2px 0px rgba(0,0,0,0.45);
box-shadow: 3px 3px 2px 0px rgba(0,0,0,0.45);}
  .Main-content {padding-top: 50px;}

It's displaying on desktop as expected (haven't worked on the mobile header elements fully). The problem I'm having is when visiting the dahlia page then navigating to other pages, specifically the homepage which is actually an index page, the code seems to still be loading and breaking the banner image. The image should be displaying as a full-screen bleed as seen at moreyhillfarm.com

Any ideas? 

P.S. Ajax loading is currently disabled but it seems to be an issue if it's on or not. 

Link to comment

Ah. Now I think I have a handle on the issue.

For the Return to Main Site link, set it to / (forward slash). It is currently going to /home, which is it's actual slug but the homepage < https://clownfish-manatee-ngnn.squarespace.com/ > is a special case and is the second URL for your home page. An alias if you will that SS sets up when you make a page the home page.

If that fixes the issue then you can turn on Ajax again if you want.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

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.