How to: Exclude Schema App scripts from WPRocket Lazy-loading

Modified on Mon, 23 Jun at 6:25 PM

If you are using Schema App's WordPress plugin to deploy highlighter markup on your pages, the WPRocket plugin may cause delays in the highlight.js deployment script deploying your schema markup/


Excluding scripts from 'Delay JavaScript execution' setting

The Delay JavaScript execution instructions from WPRocket explain the optimizations WP Rocket does to prioritize rendering of the website. 


While this is effective at increasing loading speed of the page, it has a negative effect on Schema App's highlight.js script loading schema markup on a page. In order for bots such as Googlebot to detect schema markup on your pages, Schema App's scripts must be excluded from this setting.


Step 1: Check if Delay JavaScript execution is enabled

Check first if this option is enabled. If it is not, any issue you may be encountering related to schema markup deployment is not likely related to Lazy-loading.


Step 1.1
From your WordPress dashboard, navigate to WPRocket via Settings > WPRocket


Step 1.2

Navigate to the File Optimzation tab.

Step 1.3

Scroll down to 'Delay JavaScript execution' and check if it is enabled. If it is, proceed to Step 2.


Step 2: Add Schema App's scripts 

Scroll down to 'Excluded JavaScript Files' and add applicable lines:

  • If you manually insert highlight.js into your HTML (not via Schema App's WordPress plugin), include the URL https://cdn.schemaapp.com/javascript/highlight.js on a new line.
  • If you enabed the Schema App Highlighter via your Advanced settings in the WordPress Plugin, include the text 'highlight.js' on a new line.
  • Include window.schema_highlighter on a new line. This is the configuration required by highlight.js to fetch and deploy your schema markup.


Step 3: Clear the WP Rocket Cache

Follow WPRocket's instructions to clear the cache


Step 4: Confirm that lazy-loading is disabled on the schema highlighter script

Reload a page on your site, and confirm that there are no lazyloading attributes associate with the window.schema_highlighter script.

Before excluding (lazy-loaded):


After excluding (not lazy-loaded):

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