Skip to main content
Site Builder
Indiana University
Content Components

Code

Embed code into a page

Customizations require approval

If you are adding custom code to your site, you'll need to get approval first by filling out the Website Custom Feature request form.

Overview

The Code component allows you to embed custom code—HTML, CSS, JavaScript, or PHP—directly into a page.

Common uses

  • Inserting code for embedded FireForms
  • Embedding a custom JavaScript widget
  • Integrating with an external data source using PHP
This component is for embedding code, not showing code examples. If you need to show example code as part of technical documentation, use the Code Snippet component instead.

Component fields

Element name Required Multiple
Name Internal name for the embedded code block. Visible only within the WCMS (not on the published page).
Yes No
Code file

Code file to embed (HTML, CSS, JavaScript, or PHP). Store custom code files in the site’s _code folder.

Note: PHP cannot be executed in WCMS preview. A placeholder appears instead.

Yes No
Wrap embedded HTML in a single parent element
When embedding HTML, always wrap it in a single parent element (such as <section> or <div>). Without a single top-level element, the page may fail to render correctly.

Do

  • Use the Code component for integrations or widgets that cannot be implemented as standard Site Builder components
  • Keep embedded code simple and focused on a single task
  • Wrap embedded HTML in a single top-level element (<section>, <div>, etc.)
  • Scope or namespace CSS and JavaScript to prevent conflicts with other Site Builder code
  • Ensure all code follows IU security policies and best practices
  • Put all custom code in your site's _code folder

Don't

  • Use to embed page-specific CSS or JavaScript—use Page Settings instead
  • Embed code that makes purely aesthetic tweaks—use existing components and styles
  • Embed large or complex libraries that could slow down the page
  • Embed code in a language other than HTML, CSS, JavaScript, or PHP
  • Use to create new content components—develop or request a custom component instead
  • Embed unvetted or insecure code that could introduce vulnerabilities