Skip to main content

Check for upcoming events

If there a liquid call for checking whether a site has events? I'm using the homepage except for the calendar page. I would like an h2 to display above the list of events on the homepage if there are events. If there are no events, then I don't want the h2 to display. I tried variations on % if page.calendar.has_events_upcoming %, to no avail. Is something like this possible? Thanks!

Official response from
Hey Alison, we have a {{ site.upcoming_event_pages }} variable that you might be able to check the .size or .count on to use for your conditional in this case; 

{% if site.upcoming_event_pages.count > 0 %}
…code for upcoming events…
{%
 endif %}
Share this post

Showing 2 reactions

How would you tag this suggestion?
Please check your e-mail for a link to activate your account.