Website Building » Squarespace » How Do I Create a Rotating Testimonial in Squarespace?

How Do I Create a Rotating Testimonial in Squarespace?

Last updated on December 29, 2022 @ 2:26 pm

A rotating testimonial is a great way to showcase customer satisfaction on your Squarespace website. By using a little bit of HTML code, you can create a rotating testimonial that changes randomly each time a visitor reloads your page. Here’s how to do it:

First, you’ll need to choose the testimonials that you want to rotate through. You can either write them yourself, or gather them from satisfied customers. Once you have a few testimonials, it’s time to add the HTML code to your Squarespace website.

In the HTML code, you’ll need to use the <p> tag to enclose each testimonial. The <p> tag tells the web browser that what is inside is a paragraph. Then, for each testimonial, you’ll need to use the <b> tag around the person’s name, and the <u> tag around the company they work for.

After you have all of your testimonials enclosed in <p> tags with the appropriate name and company tags, it’s time to add theRotating Testimonial code. This code will randomly select one of your testimonials each time the page is loaded.

To add the Rotating Testimonial code to your Squarespace website:

  1. In your Squarespace account, click Pages.

  2. (If you haven’t yet created a page where you want to add your rotating testimonial, hover over an existing page and click Duplicate.)

  3. Click and drag the Code block into your page content editor.

  4. In the Code Editor window that appears, paste in the following code:

  5. <div style="margin-left:60px">
    
            <script language="JavaScript">
            <!--
    
            var r_text = new Array ();
    
            r_text[0] = "This is one of my testimonials";
    
            r_text[1] = "This is another one of my testimonials";
    
            r_text[2] = "And this is one more";
    
            var i = Math.floor(3*Math.random())
    
            document.write(r_text[i]);
    
            //-->
            </script></div>
  6. Replace the text in red with your own testimonials. Be sure to keep everything else exactly as it is.

    PRO TIP: If you are not comfortable working with code, we recommend finding a developer to help you with this. Making changes to your site's code can result in breaking your site if not done correctly.
  7. Click Apply.

  8. (optional) If you want your rotating testimonial to appear on every page of your website, click Site Manager > Configure > Site Settings > Advanced > External JavaScript and paste your code into the box labeled “External JavaScript”.

  9. Then click Save & Exit at the top right.

Your rotating testimonial is now live on your Squarespace website! If you ever want to change which testimonials are displayed, simply go back and edit the code in Step 5.

Drew Clemente

Drew Clemente

Devops & Sysadmin engineer. I basically build infrastructure online.