joepferguson avatar

Fixed Docs JS error for Search on non-docs URLS

joepferguson

Published: 27 Feb 2018 › Updated: 27 Feb 2018Fixed Docs JS error for Search on non-docs URLS

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

Leave Fixed Docs JS error for Search on non-docs URLS to:

Written by

Joe Ferguson is a PHP developer and community organizer. He is involved with many different technology related initiatives in Memphis including the Memphis PHP User group. He’s been married to his extremely supportive and amazing wife for a really long time and she turned him into a crazy cat man. They live in the Memphis suburbs with their two cats.

Read more #utopian-io posts


Best Posts From joepferguson

We have not curated any of joepferguson's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From joepferguson