Jump to content

change logo in ONLY product pages

Recommended Posts

  • Replies 8
  • Views 1.3k
  • Created
  • Last Reply
2 hours ago, Alpi87 said:

Site URL: https://www.murmali.com/shop/cork-bucket-gamma-natural

Hi there! I am trying to change the logo in only my product pages (all of them). The logo from the product pages is automatically taken from the shop page. How can I change the logo in product pages while keeping the logo in the shop page? 

Thanks! 

There is class name in product page for body, if you want logo in black on shop just use this

body.collection-type-products .Header-branding img {
  filter: invert(1);
}

image.png.89f8c3dddeac93bdcf75510425140c83.png

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment

Hi bangank36, thank you for your reply. I knew this already and it does the job. However, for some reason the effect of the filter in my white logo is not very good. In some desktop screens it appears thicker and kind of blurry. When I change the logo in the shop page to the black logo, in the product pages it appears perfect. That's why I need to change the logo and not just apply a filter on the one taken from the shop page.

I know that with the following code I can change the logo in any page of the site (except for the  product pages)

<script> window.onload = function() { document.getElementsByClassName('Header-branding-logo')[0].src = 'URL'; } </script>

However I do not know how to target just the logo in the product pages...

 

Link to comment
<script> window.onload = function() { document.querySelector('body.collection-type-products .Header-branding-logo')[0].src = 'URL'; } </script>

.collection-type-products is the class of product page body

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment
6 minutes ago, Alpi87 said:

It does not work... I have tried targeting "body.collection-type-products .Header-branding-logo" and "body.collection-type-products .Header-branding img" and it still does not work.

 

It's my bad

<script> window.onload = function() { document.querySelector('body.collection-type-products .Header-branding-logo').src = 'URL'; } </script>

 

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment
5 minutes ago, Alpi87 said:

When I put that code it changes the logo in all product pages but also in the shop page... 

<script> 
  window.onload = function() { 
    var logo = document.querySelector('body.collection-type-products:not(#collection-5ebae83d182f400f38e71560) .Header-branding-logo');
    
    if (logo) {
    	logo.src = 'URL'; 
    }
  } 
</script>

This will exclude the shop, let me know, thanks

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.