Squarespace: Using Anchor Tags

One-page scrolling websites are slowly becoming more and more common. Squarespace itself has many one-page templates where the menu actually leads to different parts of the same page.

Now, there will be times where you want to accomplish this type of scrolling, but don’t know how to make it work. That’s why we’re going to show you exactly how. At the end of this guide, you’ll be able to create an anchor tag that will take people anywhere on any page. So let’s get started.

Creating the Anchor Tags and Links

  1. Go the portion of your page where you want the scroll to land.
  2. Insert a CODE block at this location.
  3. In the CODE block, go ahead and add a unique ID. If the section is for a paragraph for “ABOUT US” you can make the ID about-us-section for example. You can name it anything you want, just don’t use spaces or special symbols except for the hypen (-).
  4. Now you can go ahead and create a link where you want, it can be in the menu, it can be a picture with a link, or even a word or a button, and have the link lead to your new ID. So continuing from the above example, you can enter in the destination as #about-us-sectionOne thing to note here is that if the link leads to a different page. For example, if you put a button on your home page that says FIND OUT MORE and it leads to a specific section on a different page, make sure you include the URL SLUG for the other page. So for example, if my #about-us-section was on my ABOUT page and the button is on the home page, we would set the link as /about#about-us-section.If we didn’t include the /about then the browser would look for an ID called #about-us-section on the HOME page, and it’ll find nothing there. So we have to tell the browser that the ID we mention is on the ABOUT page.

Adding Smooth Scrolling (Not required)

Now that you have your anchor tag and links done, you’ll notice that this will take people to the specific section, but there’s no animation, so it’s hard to tell that the page has been scrolled. That’s where smooth scrolling comes in. With smooth scrolling enabled, people will land at the top of the destination page, and then the browser will automatically scroll them down to the section needed.

To get smooth scrolling working is super simple. Just add the following to SETTINGS → ADVANCED → CODE INECTION and into the top field for HEADER.

<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
 <script type="text/javascript">
      $(function() {
        $('a[href*=#]:not([href=#])').click(function() {
          if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
            var target = $(this.hash);
            target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
            if (target.length) {
                scrollTop: target.offset().top
              }, 1000);
              return false;

Want more help? We have tons of YouTube tutorials on customizing your Squarespace website. Subscribe to our channel so you will know when a new tutorial is out.

Vigasan Gunasegaran About the author

I've been working on Squarespace and WordPress websites for quite some time now. I enjoy how easy it is for clients to make updates to their own websites while using a CMS system. Outside of website design, I love good food, Netflix, and video games.

  • Courtney

    Hi there, this is working (kind of) but I think I’m doing something wrong. For example, it works but if I scroll back to the top to click on a new section, for it to work first I have to clear the hasttag in the url. I don’t know how to fix this, as I’m sure my user won’t know to do that! Any tips?

    May 22, 2019 at 5:37 AM

Leave a Reply