The @uol-widget-events pattern lets users see a selection of upcoming events sorted in chronological order.
It uses the standard @uol-widget and the @uol-event-cards components.
If there are no events available the entire widget including the widget title and “View all events” link will not display.
Use the @uol-widget-events pattern to display a selection of upcoming events, typically on a home page of section introduction page.
Do not use this pattern for:
Events widgets will normally include a link to a page where all events can be viewed. Use the widget_link object. eg:
'widget_link': {
'url': '/all-events-link',
'text': 'View all events',
}
{% if events.length %}
{% extends '@uol-widget' %}
{% block widget_content %}
{% render '@uol-event-cards', { events: events } %}
{% endblock %}
{% endif %}
<div class="uol-widget-container">
<div class="uol-widget">
<div class="uol-widget__left-col">
<div class="uol-widget__head">
<h2 class="uol-widget__title">Events widget</h2>
<a class="uol-widget__link" href="/all-events-link">View all events</a>
</div>
</div>
<div class="uol-widget__content">
<div class="events-cards">
<div class="event-card-outer">
<div class="event-card">
<h3 class="event-card__title">
<a class="event-card__link" href="/some-event-link">The Cottingley Fairies: A Study in Deception</a>
</h3>
<div class="event-card__dates">
<div aria-hidden="true">
<span class="event-card__date__start-date__day">19</span>
July 2021
</div>
<span class="hide-accessible">
19 July 2021
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{
"widget_title": "Events widget",
"widget_link": {
"url": "/all-events-link",
"text": "View all events"
},
"events": [
{
"title": "The Cottingley Fairies: A Study in Deception",
"link": "/some-event-link",
"start": "2021-07-19",
"end": "2021-07-19"
}
]
}