Malware Blocks: How Code Blocks Impact Website Security

Malware Blocks: How Code Blocks Impact Website Security

By Michael Turner

January 18, 2025 at 11:43 AM

Code Blocks let you add custom HTML, Markdown, CSS, JavaScript and other code to enhance your site's functionality beyond standard features. Here's how to use them effectively:

Adding a Code Block:

  1. Edit a page/post and click Add Block or use an insertion point
  2. Select the Code block option
  3. Click the pencil icon to open the block editor
  4. Enter your code in the text field

Best Practices:

  • For code snippets: Enable "View Source" for better formatting and readability
  • For rendering code: Select appropriate language (HTML/Markdown) from Type menu
  • For CSS: Wrap in
    <style>
    tags and select HTML type
  • For JavaScript: Wrap in
    <script>
    tags and select HTML type

Warning: Embedded scripts disabled

Warning: Embedded scripts disabled

Troubleshooting Tips:

  • Code may not display within Index pages - try removing from Index
  • Disable Ajax loading to test if it's causing issues
  • If unable to edit site, disable script preview
  • For widget-specific issues, contact the service provider

Important Notes:

  • Preview in Safe Mode to see embedded items when logged in
  • Code blocks automatically format code snippets for better readability
  • Custom code requires careful implementation to avoid site issues
  • Consider consulting Squarespace Experts for complex customizations

For security reasons, some code may not appear while logged in but will be visible to visitors. Use Preview mode to verify proper functionality.

Additional Resources:

  • Review best practices for custom code implementation
  • Consult the Squarespace Forum for developer guidance
  • Consider hiring a Squarespace Expert for complex customizations
  • Reference the general guide for code-based customizations

Related Articles

Previous Articles