Skip to Content

Source Code Assets

Source code assets are used for entering source code or scripts such as JavaScript or PHP into a page. Because OU Campus uses XML/XSL to render pages, source code assets must have valid XML syntax to avoid causing errors when placed on pages.

Create New

  1. Navigate to Content > Assets.
  2. Click the green +New button.
  3. Select "Source Code."
  4. An asset name is required. Description and tags are optional, but tags can make it easier to find when searching for an asset to place on a page. Checking "Lock to site" means the asset can only be used in the site where it was created.
  5. Set access settings for the asset if desired.
  6. Write the asset content in the mini-source code editor.
  7. Click Create to make the asset.

Your asset is now available for use on pages, but must be published before it appears on any live web pages.

Use

While technically any kind of code can be entered into a source code asset, remember that the code is inserted into the page on publish. Therefore, it must be valid XML, or the page won't render correctly.

Note: Boolean attributes, or attributes that don't have a value assigned, are not valid XML. For these attribute types, add the attribute name as the value, e.g., <script async></script> should be written as <script async="async"></script>. All "&" must be encoded as well. 

A common use for source code assets is inserting a news or events feed into a page.