Jump to content

Show Filenames in Lightbox only from Grid Gallery

Recommended Posts

Hi all,

I'm wondering if there's a way to code for showing file names (not captions) when photos are opened in a lightbox from a grid gallery.

My client has hundreds of family photos, all named appropriately (i.e., Andy_1962.jpg) and they want the file name to show when opened in the lightbox, but not on the grid.

I tried the below code, but it didn't work. Any insight?


Header injection:

<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha384-vtXRMe3mGCbOeY7l30aIg8H9p3GdeSe4IFlP6G8JMa7o7lXvnz3GFKzPxzJdPfGK" crossorigin="anonymous"></script>
  window.Squarespace.onInitialize(Y, function(){
    $('.slide img').each(function(i) {
      $('.image-slide-title').eq(i).html('' + $(this).attr('alt').replace('.jpg', '') + '');



.sqs-gallery-block-grid.sqs-gallery-block-meta-only-title .margin-wrapper .image-slide-title {
  line-height: 1.2em;
  white-space: pre-wrap;
  overflow: visible;


Mary Alice 

Link to comment
  • Replies 1
  • Views 288
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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.