spurds Posted February 15 Share Posted February 15 Probably a very simple question/fix but when I search on my website using the search block, the results page shows the name of the jpg file associated with the item. Is there a way to stop this from happening? I would of course rather the description of the product (or some of it) to show instead. Thanks! Link to comment
tuanphan Posted February 21 Share Posted February 21 Hi, You can add this code to Code Injection > Footer to remove jpg name <!-- Remove jpg in search page --> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script> <script> const attrObserver = new MutationObserver((mutations) => { mutations.forEach((mu) => { if (mu.type !== "attributes" && mu.attributeName !== "class") return; trimEXT(); }); }); const ELS_test = document.querySelectorAll(".search-results"); ELS_test.forEach((el) => attrObserver.observe(el, { attributes: true })); function trimEXT() { $(".search-results img").ready(function () { $(".sqs-search-page .sqs-title").html(function () { return $(this).html().replace(".jpg", "").replace(".png", "").replace(".jpeg", ""); }); }); } $(document).ready(function () { trimEXT(); }); </script> Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment