Jump to content

Workaround for image title taken from filename instead of Object Name metadata?

Go to solution Solved by LKW,

Recommended Posts

Posted (edited)

Does anyone have a workaround for the problem of image titles defaulting to filename instead of to the Object Name in the image's metadata? Maybe there's another metadata field that SS is now taking the image title from?

We're a tiny non-profit, and once a year we hold a fundraiser auction. To create the auction catalog, we upload a big batch of image files with metadata containing Object Name and Caption-Abstract tags to populate image titles and descriptions respectively. The latter still works, but this year, for no apparent reason, SS is ignoring the Object Name tag and putting the filename in the title.

I can see two possible workarounds: 1) Rename the files on local disk before uploading them or 2) manually replace each filename in the image settings after uploading. Option 1 will not work because of special characters and sort order, and option 2 will be laborious and prone to error.

Is there a third option? 🤞🤞🤞

Edited by LKW
  • Replies 2
  • Views 1.1k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

I discovered option 1 won't work because the file uploader refuses to upload files without filename extensions. E.g., a file renamed from "IMG123456.jpg" to "Sunset Clouds" won't upload. Sadly, the extension does appear as the image title if the file was uploaded as "Sunset Clouds.jpg".

And I realized option 2 is not only laborious, but you'd have to do it all over again if you ever wanted to replace the entire batch of images with a new upload. So, a complete non-starter.

  • Solution
Posted (edited)

Here is the workaround I came up with. I used our image metadata spreadsheet to generate a script that renames my image files.  I gave them names like _IMG123456_Sunset Clouds_.jpg and uploaded them to a gallery page. The ugly image filenames appear as titles on that page, but luckily we have only one page that needs to show image titles and that's a page with a gallery block. So I injected this code on the page where the gallery block will appear:

<script>
jQuery(document).ready(function($) {
  $( "div.image-slide-title" ).each( function(){ 
	var fnstr = $( this ).text();
	$( this ).text( fnstr.split( "_" )[2] ); 
  });
});
</script>

The gallery block now shows thumbnails with nice image titles extracted from the filenames. The lightbox still displays the ugly filename, but we were already suppressing the lightbox's image titles anyway because we only need the image description to appear in that context:

<style>
  .sqs-lightbox-meta h1 { font-size: 0em !important; }
</style>

This ungainly workaround seems to solve our problem, for this tiny case at least, on our 7.0 Montauk site.

Edited by LKW

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.