How to: Set up a self-hosted JavaScript Deployment

Modified on Thu, 21 Nov at 12:49 PM

If you prefer to serve Schema App's deployment script from your site rather than retrieving it from our content delivery network (CDN), this document outlines the process of hosting our highlight.js deployment script on your website.


Here's how to set up a self-hosted JavaScript deployment.


Step 1: Download highlight.js from Schema App's CDN and embed in your website's HTML


The highlight.js deployment script must be retrieved from Schema App's CDN. Links to the currently supported versions of highlight.js can be found at Highlight.js Releases.


1.1 Navigate to the list of currently supported Highlight.js Releases. Scroll to the latest version, right click on the Download link, and select "Save Link As..." to download the highlight.js deployment script. 



1.2 Serve and embed the highlight.js deployment script directly from your site. The src attribute should point to the path in your server where you store highlight.js. For example, if the directory that contains highlight.js in your infrastructure is files/scripts/ :


<script async src="/files/scripts/highlight.js"></script>


Step 2: Embed a script configuration tag in your website's HTML


When self-hosting highlight.js, in addition to serving highlight.js from your site, a script configuration tag needs to be embedded in the page. The configurations set here, such as your account ID, are used to create and deploy your schema markup.


2.1 See Highlighter Deployment Options to determine which configurations you should use.


2.2 Embed a script configuration tag in your site's HTML using the configurations from the previous step.  For example, a script configuration tag containing a configuration for a standard JavaScript deployment for the account ID "Cupcake":


<script>window.schema_highlighter={accountId: "Cupcake", outputCache: true}</script>


Step 3: Whitelisting Schema App


In order to allow highlight.js to fully function (including markup authoring and reporting), Schema App's IP address, user agent, and API endpoints must be whitelisted.


3.1 Follow the instructions to whitelist Schema App from the support page Whitelist Schema App IP Address & Endpoints for Full Functionality.


Support


If you need assistance with setting up your self-hosted highlight.js deployment, contact us at [email protected].


Additional Resources

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article