If you have coding knowledge and want to embed custom content in a page or post, you might want to use the Code Block or Embed Block. We often hear the question, “Which block is best for what I want to add?” This guide covers the primary differences and things to consider when adding code to pages on your site.
Try other blocks
Instead of embedding content using code, Squarespace has a variety of other blocks that display all types of media -- no coding knowledge required. Try the Video Block, Instagram Block, Flickr Block, SoundCloud Block, Map Block, or OpenTable Block to start.
By using our built-in features, your site will load faster, the content will blend in with your site's template, and we can help you troubleshoot any issues. Custom code, however, is an advanced modification that falls outside of the scope of Squarespace support.
You can use the Embed Block to display basic third-party content on your site, like a photo or video. It’s common to use the Embed Block for:
- Tweets - Embed tweets using the Twitter Block instead
- Facebook posts
- Videos from a host unsupported by Squarespace - We recommend adding directly from YouTube, Vimeo, Wistia, or Animoto in the Video Block instead.
If you have more advanced and customizable code, the Code Block is the best choice. It’s versatile and can render code in HTML and Markdown. You can also use it to display code snippets.
It’s common to use the Code Block for customizations like:
- Third-party maps - For a built-in option, use the Map Block instead
- Embedded documents through a service like Issuu
- Unsupported forms through a service like Wufoo
- Advanced social sharing and forums
Note: Code-based customization falls outside the scope of our support. This means that we’re unable to help further with setup or troubleshooting. Additionally, with a code-based solution, we can’t guarantee its functionality or full compatibility with Squarespace. This includes how it functions with our responsive design, particularly its appearance on mobile devices, and if it functions on all templates. Code-based customizations can also cause display issues with future updates to our platform. While we can't help further, there are many resources that can point you in the right direction: