Sites Component API for Oracle Content Management

Sites Component API for Oracle Content Management

The Sites Component API (SCSComponentAPI) is an environment agnostic object present on all Oracle Content Management web pages and during Site Compilation. It is primarily responsible for providing information about the site to allow developers to create HTML for components that can be inserted into the page.

For environment specific functionality, continue to use the SCSRenderAPI when in the browser or the SCSCompileAPI when compiling the site.

The SCSComponentAPI abstracts the developer from how resources are loaded and provides information on constructing URLs and access to common libraries that work when the component is rendered in the browser or during a server-side compile.

The SCSComponentAPI is passed as a parameter to all custom code. For example, when creating a content layout, you can create code that will work in both the browser and during compile:

const BaseComponent = class {
    constructor({ SCSComponentAPI, contentItemData }) {
        this.componentAPI = SCSComponentAPI;
        this.contentItem = contentItemData;

        this.componentPath = import.meta.url.replace('/baseComponent.mjs', '')
    }