.png?table=block&id=218105a2-9d95-819e-982c-e70d89c6f0c2&cache=v2)
Last Edited Time
Jun 25, 2025 09:35 PM
Do not index
Do not index
Suggested Tag
Squarespace
custom code implementation
code block usage
Tags Synced
Tags Synced
AI summary
Enhance your Squarespace site with custom code blocks to add HTML, CSS, JavaScript, or Markdown. Be aware of limitations like size, plan restrictions, and lack of support. Troubleshoot common issues by adjusting settings and testing in incognito mode.
Last edited by
Platform
Category
Topic
Squarespace Code Blocks: Your Guide to Adding Custom Code
Learn to enhance your Squarespace site with custom code blocks effectively.
TL;DR: Key Points
- Use code blocks to add custom HTML, CSS, Markdown, or JavaScript to your site
- Add code blocks to any page, blog post, or sidebar area
- JavaScript and iframes work on Business plans and above
- Each code block has a 400 KB size limit
- Display problems can often be fixed by turning off Ajax loading or removing pages from Index layouts
- Squarespace support won't help with custom code issues
What Are Code Blocks?
Code blocks let you add custom elements to your Squarespace site that go beyond the standard blocks. You can use them to embed third-party widgets, add custom styling with CSS, include JavaScript functionality, or display code snippets if you're writing technical content.
Think of them as blank canvases where you can paste HTML, CSS, JavaScript, or Markdown code.
How to Add a Code Block
- Edit your page: Click Edit on the page where you want to add custom code
- Add the block: Click the + icon where you want the code block to appear, then select Code from the menu
- Paste your code: Drop your HTML, CSS, JavaScript, or Markdown into the text field
- Choose display settings:
- Turn on "Display Source" if you want to show the actual code (useful for tutorials)
- Leave it off if you want the code to run normally
- For CSS, wrap it in
<style>
tags - For JavaScript, wrap it in
<script>
tags
Fixing Common Problems
Your code isn't showing up
Try viewing your page in an incognito window. Sometimes code blocks don't display properly when you're logged into Squarespace.
Code works elsewhere but not on your site
Turn off Ajax loading in your site settings (Settings > Advanced > Performance). Ajax can interfere with custom JavaScript.
Code block won't work on an Index page
Index pages (like portfolio galleries or blog summary pages) can cause issues. Try moving your page out of any Index layout and test again.
Code displays as text instead of running
Make sure you haven't accidentally turned on "Display Source" in the code block settings.
Important Limitations
- Plan restrictions: JavaScript and iframes only work on Business plans and higher
- Size limit: Each code block can handle up to 400 KB of code (roughly 300,000 characters)
- No support: Squarespace won't troubleshoot custom code issues for you
- Updates can break things: Platform updates occasionally affect custom code
Quick Reference
Code Blocks: Special areas in Squarespace where you can add custom HTML, CSS, JavaScript, or Markdown
CSS: The language that controls how your website looks (colours, fonts, spacing)
HTML: The basic building blocks of web pages
JavaScript: Code that makes websites interactive (animations, pop-ups, dynamic content)
Markdown: A simple way to format text using symbols (popular with developers)
Ajax: A web technology that loads content without refreshing the page (can conflict with custom code)
Iframes: A way to embed content from other websites (like YouTube videos or Google Maps)
Final Thoughts
Code blocks give you serious flexibility to customise your Squarespace site beyond the standard options. Start small with simple HTML or CSS additions before moving on to JavaScript.
Remember that custom code means you're on your own when things go wrong. Always test your additions thoroughly, and keep backups of working code. When Squarespace updates their platform, be prepared to troubleshoot any custom code that stops working.