Jump to content

Search function results page shows image file name

Recommended Posts

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. 


Link to comment
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic


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>
const attrObserver = new MutationObserver((mutations) => {
  mutations.forEach((mu) => {
    if (mu.type !== "attributes" && mu.attributeName !== "class") return;

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 () {


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

Create an account or sign in to comment

You need to be a member in order to leave a comment

  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.