By continuing to use this site, you agree to the storing of first- and third-party cookies on your device to enhance site navigation; analyze site, product, and service usage; and assist in our marketing and promotional efforts. Cookie Policy

 
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 NewLink to this section

  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.

UseLink to this section

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.

EditLink to this section

To edit an existing source code asset:

  1. Navigate to Content Assets.
  2. Click on the name of the asset you want to edit.
  3. Check out the asset by selecting the lightbulb icon. 
  4. Click Edit in the main toolbar.
  5. Edit the source code as necessary.
  6. Click Save.
  7. Publish the asset for your changes to appear on the live website.