Jump to content

Changing logo link

Go to solution Solved by KwameAndCo,

Recommended Posts

  • Replies 3
  • Views 1.4k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Solution

In that section, create a markdown or code block and put this in it.

<script>
  const linkDestination = "mylink";
  let parentElement = document.currentScript.parentElement;
  while (parentElement.tagName.toLowerCase() !== 'section') parentElement = parentElement.parentElement;
  parentElement.id = linkDestination;
  document.querySelectorAll('.header-title-logo a, .header-mobile-logo a').forEach(link => link.href = '/#' + linkDestination);
</script>

Change "mylink" to whatever you want to use as the anchor for the section.

It will then replace the logo link with a link to this section on the homepage.

IF you wanted to do it on another page you'd have to tweak it but this should solve your issue.

Work With Me 🖥️💻📱

Please remember to tag me so that I get a notification and respond to your help requests.

If my answers have helped you, please drop a like and mark my answer as best to help other users find solutions quickly.

You can also thank me or make requests by buying me a coffee . (Caffeine fuels me to take more requests)

For Squarespace Tips & Tricks, visit @squareskills (Youtube 📺 Tutorials)

For Premium and FREE plugins, visit Squareskills (Plugin Store) 🧩

Some links may be affiliate/referral links.

Link to comment
On 9/28/2023 at 5:50 PM, KwameAndCo said:

In that section, create a markdown or code block and put this in it.

<script>
  const linkDestination = "mylink";
  let parentElement = document.currentScript.parentElement;
  while (parentElement.tagName.toLowerCase() !== 'section') parentElement = parentElement.parentElement;
  parentElement.id = linkDestination;
  document.querySelectorAll('.header-title-logo a, .header-mobile-logo a').forEach(link => link.href = '/#' + linkDestination);
</script>

Change "mylink" to whatever you want to use as the anchor for the section.

It will then replace the logo link with a link to this section on the homepage.

IF you wanted to do it on another page you'd have to tweak it but this should solve your issue.

This solves the problem. Thank you! What should I do to have logos on all pages bring me to that section? Right now it only works on the home page. 

Link to comment
8 hours ago, YumoBennyYang said:

This solves the problem. Thank you! What should I do to have logos on all pages bring me to that section? Right now it only works on the home page. 

Please mark my response as a solution for others.

If you're gong to do it on all pages, you'd need to put this in the section in a markdown/code block and make sure it's at the top of the section (especially on mobile).

<div style="display:none" id="yourid"></div>

.. and then add this to the global footer.

<script>
  // @Squareskills - Link Logos to Section
  document.querySelectorAll('.header-title-logo a, .header-mobile-logo a').forEach(link => link.href = '/#yourid');
</script>

Making sure to change "yourid" to whatever you want in both instances!

Work With Me 🖥️💻📱

Please remember to tag me so that I get a notification and respond to your help requests.

If my answers have helped you, please drop a like and mark my answer as best to help other users find solutions quickly.

You can also thank me or make requests by buying me a coffee . (Caffeine fuels me to take more requests)

For Squarespace Tips & Tricks, visit @squareskills (Youtube 📺 Tutorials)

For Premium and FREE plugins, visit Squareskills (Plugin Store) 🧩

Some links may be affiliate/referral links.

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.