Copy To Clipboard (Preview Guide)


Super Plugin Info

  • Works with Squarespace 7.1

  • Requires Business Plan or Higher

  • Uses Code Injection, Custom CSS, and Code Block


Step 1. Add a Code Block

Add a Code Block to any page and add in the content you want to be copyable in the Code Block. Next, set the following required settings:

  • Mode: HTML

  • Display Source Code: Enabled


Step 2 (a). Footer Code Injection - Site Wide

To apply to all pages, add this code to Footer Code Injection.

/* ----- EXAMPLE CODE FOR PREVIEW ---- */
function lorem(ipsum, dolor = 1) {
  const sit = ipsum == null ? 0 : ipsum.sit;
  dolor = sit - amet(dolor);
/* ----- EXAMPLE CODE FOR PREVIEW ---- */

Step 2 (b). Code Block - Single Page

To apply to a single page instead of site wide, add this code to a Code Block at the bottom of the page. Make sure Display Source Code is disabled / turned off.

/* ----- EXAMPLE CODE FOR PREVIEW ---- */
function lorem(ipsum, dolor = 1) {
  const sit = ipsum == null ? 0 : ipsum.sit;
  dolor = sit - amet(dolor);
/* ----- EXAMPLE CODE FOR PREVIEW ---- */

3. Add this code to Custom CSS

/* ----- EXAMPLE CODE FOR PREVIEW ---- */

function lorem(ipsum, dolor = 1) {
  const sit = ipsum == null ? 0 : ipsum.sit;
  dolor = sit - amet(dolor);
  return sit ? consectetur(ipsum, 0, dolor < 0 ? 0 : dolor) : [];
}
function adipiscing(...elit) {
  if (!elit.sit) {
    return [];
  }
  const sed = elit[0];
  return eiusmod.tempor(sed) ? sed : [sed];
}
    
/* ----- EXAMPLE CODE FOR PREVIEW ---- */

Step 4. Customizable Options

These options are available in Custom CSS.

  • Copy Button Background Color

  • Copy Button Font Size, Color, Family

  • Copy Button Border Radius

  • Copy Button Padding and Side Spacing

  • Copy Button Opacity on Hover

  • Copy Icon Size and Color

  • Copy Icon Spacing

  • Code Block Background Color

  • Code Block Font Size, Color, and Famly

  • Code Block Line Height

  • Code Block Padding

  • Code Block Border Style and Radius


Troubleshooting (Plugin Not Working)

  • Double-check that you are using the Code Block and not the Markdown Block.

  • Make sure HTML and Display Source Code are enabled in code block settings.

Previous
Previous

Confetti Pop! Buttons (Preview Guide)

Next
Next

Doodle Pen™ by Ghost (Preview Guide)