Jump to content

Reroute Site Title URL link

Recommended Posts

Hi, I'm looking to reroute the URL link for a site title (7.1 Fluid engine). 

 

Here's the current code:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

<script>$(document).ready(function () {
         $("#site-title").attr("href", "https://www.dream.industries/garden");
       });
</script>
 

It works great. One problem, it doesn't work on mobile. Not sure why. 

 

Can anyone help?

 

Thank you in advance if so. 

Link to comment

It can be done with simple javascript:

Add this line in Code Injection > Footer

<script>
window.onload = function () {
    document.querySelectorAll("#site-title").forEach((el) => {
      el.setAttribute("href", "https://www.dream.industries/garden");
    });
};
</script>

Link to comment

Thank you for the reply, I appreciate the help. 

 

Regrettably, this doesn't fix the issue. When I use this code instead of the first one, the url doesn't reroute at all. 

 

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.