Show events by year?

Hi friends, on calendar pages: is it possible to template request for upcoming events by year, say, get events only for 2018?

Official response from

Hi Jedd! This is definitely possible. In the Template for your calendar page, you'll notice a couple 'forloops' that are responsible for scanning through all of your upcoming events and displaying the same type of details for each one (i.e. Event name, location, date, etc..). It'll look like this:

{% for event in page.calendar.events_upcoming %}
<li>{% include "event" %}</li>
{% endfor %}

However, you can add an "IF/THEN" statement in there using liquid, having it examine the event "start at" date, like so:

{% for event in page.calendar.events_upcoming %}

{% capture eventyear %}{{ event.local_start_at | date: '%Y'  }}{% endcapture %}

{% if eventyear == "2018" %}
<li>{% include "event" %}</li>

{% endif %}
{% endfor %}


Let me know if you run into any problems adding this to your calendar page!

Complete and current information on how to use NationBuilder is available in the documentation section.

Share this post

Showing 3 reactions

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