Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0
alicroft

Automatically display text when summary block is empty

Question

I've tried every solution I could find here on the Circle forum, but none are working!

page: https://theveil.squarespace.com/nfk
(scroll down to "Upcoming Events" section)

template: Royce

I've got a Summary Block displaying Events, filtered by Category. When nothing matches the filter criteria, there is just a big black space on the page. I'd prefer it to automatically display text when the summary block is empty, like

"There are no upcoming events at this location."

Note: The Upcoming Events section on the page is actually a page (/nfk-events) nestled within an Index Collection (/nfk), in case it matters.

Anyone have ideas / updates to the old solutions for this? (https://forum.squarespace.com/search/?&q=empty summary block&search_and_or=and&sortby=relevancy)

Screen Shot 2019-11-11 at 20.17.50.png

Edited by alicroft
add detail

Share this post


Link to post

15 answers to this question

Recommended Posts

  • 1

Hi @alicroft

The solution that I provided in March 2018 still works if the template doesn't use Ajax or if it is disabled.

It's an old answer, so if you have Ajax enabled, you'll need to replace the domready function with onInitialize instead:

<script>
window.Squarespace.onInitialize(Y, function(){ 
  var summaryExists = document.getElementsByClassName("summary-title")[0];
  if (summaryExists == null) { 
    document.getElementById('no-events').innerHTML = "There are no upcoming events at this location.";
  }
}); 
</script>

 


sf-digital-signature-logo-email145.png.46606a2288a2847f44d81b9b7b58f3a5.png
Hi, I'm Paul, founder of SF Digital, a specialist company building the features that Squarespace didn't include
I am a Squarespace Expert and Squarespace Circle Leader with a
strong reputation on the Squarespace Forum. I'm trusted by thousands of Squarespace users worldwide, including designers, freelancers, business owners and agencies. My extensions add capabilities to Squarespace websites around the globe. They include the Enquiry Form ExtensionDatepicker Extension and Age Verification ExtensionNeed a custom Squarespace extension? Tell me about the functionality you need. Note that some links in my posts may be affiliate links. Book a Squarespace Expert when you need help.

Share this post


Link to post
  • 1

It will only work if you are logged on, or if you load that specific page. If you navigate from another page to that one, it won't. 

 


sf-digital-signature-logo-email145.png.46606a2288a2847f44d81b9b7b58f3a5.png
Hi, I'm Paul, founder of SF Digital, a specialist company building the features that Squarespace didn't include
I am a Squarespace Expert and Squarespace Circle Leader with a
strong reputation on the Squarespace Forum. I'm trusted by thousands of Squarespace users worldwide, including designers, freelancers, business owners and agencies. My extensions add capabilities to Squarespace websites around the globe. They include the Enquiry Form ExtensionDatepicker Extension and Age Verification ExtensionNeed a custom Squarespace extension? Tell me about the functionality you need. Note that some links in my posts may be affiliate links. Book a Squarespace Expert when you need help.

Share this post


Link to post
  • 0

Thank you so much @paul2009, that worked perfectly!

For anyone else trying the same:

The script did not work in the page header injection (/nfk-events), but it did in the Index Collection header injection (/nfk).

Share this post


Link to post
  • 0

To be clear, the code won't work in the page header injection of either of these if you have Ajax enabled.

(Note that Ajax is never enabled when you are logged on to a site! This makes it appear to work whilst logged on, but as soon as you hand over a site and the client tries it, they'll find it doesn't work 😫

If further checks are added to the code to identify the collection or URL it can then be inserted in the Footer Injection and it will play nice with Ajax 🙂.


sf-digital-signature-logo-email145.png.46606a2288a2847f44d81b9b7b58f3a5.png
Hi, I'm Paul, founder of SF Digital, a specialist company building the features that Squarespace didn't include
I am a Squarespace Expert and Squarespace Circle Leader with a
strong reputation on the Squarespace Forum. I'm trusted by thousands of Squarespace users worldwide, including designers, freelancers, business owners and agencies. My extensions add capabilities to Squarespace websites around the globe. They include the Enquiry Form ExtensionDatepicker Extension and Age Verification ExtensionNeed a custom Squarespace extension? Tell me about the functionality you need. Note that some links in my posts may be affiliate links. Book a Squarespace Expert when you need help.

Share this post


Link to post
  • 0

@paul2009 I have Ajax enabled, and inserted your code as written above into the Collection's header injection, and it's working...!

Is this delicate in some way? (I know nothing about Ajax or javascript!) Should I move it into the Footer Injection area of the site instead? I'd prefer to leave it on the Collection so I can customize what it says for each summary block on the site, if possible.

Share this post


Link to post
  • 0

I wrote a guide that may help you to understand how Ajax affects JavaScript on Squarespace:

https://sf.digital/squarespace-solutions/why-doesnt-my-code-work-until-i-refresh-the-page


sf-digital-signature-logo-email145.png.46606a2288a2847f44d81b9b7b58f3a5.png
Hi, I'm Paul, founder of SF Digital, a specialist company building the features that Squarespace didn't include
I am a Squarespace Expert and Squarespace Circle Leader with a
strong reputation on the Squarespace Forum. I'm trusted by thousands of Squarespace users worldwide, including designers, freelancers, business owners and agencies. My extensions add capabilities to Squarespace websites around the globe. They include the Enquiry Form ExtensionDatepicker Extension and Age Verification ExtensionNeed a custom Squarespace extension? Tell me about the functionality you need. Note that some links in my posts may be affiliate links. Book a Squarespace Expert when you need help.

Share this post


Link to post
  • 0
1 minute ago, Ida_nymand said:

I'm unable to see the answer, you provided. Do you know why that is?

You can't see the original post because Squarespace upgraded their forum and deleted lots of content. However, I had repeated the answer below the link (as shown in your screenshot 🙂).


sf-digital-signature-logo-email145.png.46606a2288a2847f44d81b9b7b58f3a5.png
Hi, I'm Paul, founder of SF Digital, a specialist company building the features that Squarespace didn't include
I am a Squarespace Expert and Squarespace Circle Leader with a
strong reputation on the Squarespace Forum. I'm trusted by thousands of Squarespace users worldwide, including designers, freelancers, business owners and agencies. My extensions add capabilities to Squarespace websites around the globe. They include the Enquiry Form ExtensionDatepicker Extension and Age Verification ExtensionNeed a custom Squarespace extension? Tell me about the functionality you need. Note that some links in my posts may be affiliate links. Book a Squarespace Expert when you need help.

Share this post


Link to post
  • 0

Thanks, I thought that was in relation to disabling Ajax, haha.  I've tried to insert the code in my Index page header injection, but it doesn't seem to be working. I don't have Ajax enabled.

I'm using the Stella template - do you think this might be why it's not working? 

 

Share this post


Link to post
  • 0
2 hours ago, Ida_nymand said:

I'm using the Stella template - do you think this might be why it's not working? 

Stella is a Brine-family template, so it should be fine. The code needs to be inserted in the site footer injection area. (Settings > Advanced > Code Injection). If it doesn't work for you, please post a working link to the page.

 


sf-digital-signature-logo-email145.png.46606a2288a2847f44d81b9b7b58f3a5.png
Hi, I'm Paul, founder of SF Digital, a specialist company building the features that Squarespace didn't include
I am a Squarespace Expert and Squarespace Circle Leader with a
strong reputation on the Squarespace Forum. I'm trusted by thousands of Squarespace users worldwide, including designers, freelancers, business owners and agencies. My extensions add capabilities to Squarespace websites around the globe. They include the Enquiry Form ExtensionDatepicker Extension and Age Verification ExtensionNeed a custom Squarespace extension? Tell me about the functionality you need. Note that some links in my posts may be affiliate links. Book a Squarespace Expert when you need help.

Share this post


Link to post
  • 0
16 hours ago, paul2009 said:

Stella is a Brine-family template, so it should be fine. The code needs to be inserted in the site footer injection area. (Settings > Advanced > Code Injection). If it doesn't work for you, please post a working link to the page.

 

I tried to insert the code in the site footer injection area, but it's still not working. Would be great if you would take a look at it. Link to the page: https://www.rumligcph.dk/hjem 

The Summary Block is located under the 'Events' headline. 

Thanks! 

Share this post


Link to post
  • 0

Your Summary Block is showing some upcoming events, so the message will not be shown.

1943208354_Screenshot2020-04-30at12_19_46.png.7f6cd6e8bd3a37ca0277f2cd25592369.png


sf-digital-signature-logo-email145.png.46606a2288a2847f44d81b9b7b58f3a5.png
Hi, I'm Paul, founder of SF Digital, a specialist company building the features that Squarespace didn't include
I am a Squarespace Expert and Squarespace Circle Leader with a
strong reputation on the Squarespace Forum. I'm trusted by thousands of Squarespace users worldwide, including designers, freelancers, business owners and agencies. My extensions add capabilities to Squarespace websites around the globe. They include the Enquiry Form ExtensionDatepicker Extension and Age Verification ExtensionNeed a custom Squarespace extension? Tell me about the functionality you need. Note that some links in my posts may be affiliate links. Book a Squarespace Expert when you need help.

Share this post


Link to post
  • 0
On 4/30/2020 at 1:21 PM, paul2009 said:

Your Summary Block is showing some upcoming events, so the message will not be shown.

1943208354_Screenshot2020-04-30at12_19_46.png.7f6cd6e8bd3a37ca0277f2cd25592369.png

Sorry for the late reply. There are two Summary Blocks on the page - one is located under the headline 'Events' and not showing anything (this is the one, where I would like the 'no upcoming events' text), while the other is showing the latest blogposts (the one in your screenshot). 

Maybe the problem is that there are two Summary Blocks on the page? 

  

Skærmbillede 2020-05-05 kl. 20.42.52.png

Share this post


Link to post
  • 0

Hi! I'm wondering if this solve works with either version of Squarespace. Tried it on 7.1 and having no luck (with either the Ajax and non-Ajax code). Still tinkering but thought I'd ask in the meantime.

Share this post


Link to post

Create an account or sign in to comment

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


×
×
  • Create New...