Refactored Javascript v2

Modified on Wed, 18 May 2022 at 12:09 PM

This is near complete re-development of the highlighter script. It was designed to solve problems that existed and improve performance of the existing highlight.js script. 


Some high-level features it offers are


  • Built in schemaFunctions, customers no longer need separate scripts, pro customers also use highlight.js now, because they can’t access highlighter in the app they can’t gain the highlighter functionality however so we have increased our offering for those customers. One script for the customer and us to maintain i.e.  highlight.js

  • Faster and more retries. On pages that are slower or more dynamic it can take a while to load so highlighter will only try failed highlights and will retry for a longer period of time. This will particularly help JS+cache and JS+webhook users.


  • Applies LER results after the markup is completely generated making the chances of a match much higher and highlight ordering no longer matters. It will reapply each time a failed highlight is generated as well so if the name property doesn’t turn up right away it will still match later on.


  • Calls our new api.schemaapp apis instead of the randomly generated AWS urls making it easier for customers to white list all Schema App domains and see where requests are going. 


  • Data source included right within the json-ld element (data-source attribute) allows one to see in the document and the RRT/ Search console which template generated the markup.


  • Debug utility allows anyone to run the highlighter in the web console to re-deploy, see failed highlights, and see all templates that are deploying. This is especially useful for js+caching where markup is delayed.

  • Removing schemaFunctions saves around 5-10% of the overall time we take to execute so you can expect a little bump in performance, also it's one less request for a script so that's always faster for users. see here where Yahoo recommends https://developer.yahoo.com/performance/rules.html#num_http and resources google recommends: https://web.dev/third-party-javascript/#network



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 atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article