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

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center