4th Street Bar Hive-Bar

Hive-Bar Powered by Hive beta-fdb5b5b

Community post

Fixed Docs JS error for Search on non-docs URLS

Bug Fixes

  • JavaScript errors from embedded Algolia search JS was looking for a #docsearch element that was only on pages using the docs template. Any page being loaded was using the search JavaScript code and non docs pages would throw the console errors.

  • What was the solution?
    Check the page to see if the current page was in the /docs url structure, if so load the search JavaScript code, otherwise do nothing. This solves the issue on non-search pages no longer loading the JavaScript when it wasn't needed, and no longer throws the console errors.



Posted on Utopian.io - Rewarding Open Source Contributors

1 upvotes $0.00

Replies (2)

Review before signing

Posting as . Signing with . Keychain permission: Posting. Hive Keychain will ask you to approve this action next.


  
Technical details

Operation fingerprint: