Adding custom code to your Squarespace site is a great way to add your own personal touch, or to extend the functionality of your site. There are two ways to add custom code to Squarespace: through the Code Injection tool, or by adding a Code Block.
Code Injection:
Code Injection is a feature that allows you to add your own custom HTML, CSS, and JavaScript to your site. You can access Code Injection under the Design tab in your Site Manager. To learn more about using Code Injection, check out our Using Code Injection support guide.
Code Blocks:
Code Blocks are a versatile Squarespace feature that allow you to insert HTML, CSS, and JavaScript into your site.
Unlike Code Injection, which applies your code site-wide, Code Blocks only affect the content within the block itself. This makes them ideal for adding custom code to individual pages or blog posts. To learn more about using Code Blocks, check out our Working with Code Blocks support guide.
Conclusion:
Both the Code Injection tool and Code Blocks are great ways to add custom code to your Squarespace site. If you want to add code that will affect your entire site, then Code Injection is the way to go.
However, if you only want to add code to specific pages or blog posts, then Code Blocks are a better option. Whichever method you choose, be sure to check out our support guides for more information.