As a visitor, I want a dedicated upcoming events page so I can quickly see what events are coming up next.
🧠 Context
The nav already has a slot for events/upcoming but the page doesn't exist yet. The events section (layouts/_default/events.html) is a good reference for structure and CSS classes.
Since Hugo generates static HTML at build time, now reflects the build date — not the visitor's actual date. To handle this, Hugo renders all events upcoming as of the last build, and a small inline script removes any that have since passed using the browser's real current date. The script only runs on this page and does not affect /events.
If no cards remain after JS filtering, a fallback message with a link to /events is shown. Since Hugo can't know at build time whether all cards will be removed, this fallback is hidden by default and revealed by JS when needed.
🛠️ Implementation Plan
-
Create content/events/upcoming/_index.md
Similar to content/events/_index.md — set layout: upcoming-events and title: "Upcoming Events".
-
Create layouts/_default/upcoming-events.html
Model the structure on layouts/_default/events.html. Use Hugo to filter events upcoming as of build time:
{{ $today := time.AsTime (now.Format "2006-01-02") }}
{{ $upcoming := (where (where .Site.RegularPages "Section" "events") ".Date" "ge" $today).ByDate }}
Render each card with a data-date attribute on the wrapping <a>:
<a data-date="{{ .Date.Format "2006-01-02" }}" class="event_card_link hvr-float" href="{{ .RelPermalink }}">
Include a hidden fallback message (e.g. display: none) with a link to /events for when no cards remain.
-
Add an inline script that runs on page load:
- Gets today's date from the browser
- Removes any
[data-date] cards whose date is before today
- If no cards remain, reveals the fallback message
-
Verify with hugo server that:
- Upcoming events display correctly
- Manually setting the script's "today" to a future date hides all cards and reveals the fallback message
✅ Acceptance Criteria
As a visitor, I want a dedicated upcoming events page so I can quickly see what events are coming up next.
🧠 Context
The nav already has a slot for
events/upcomingbut the page doesn't exist yet. The events section (layouts/_default/events.html) is a good reference for structure and CSS classes.Since Hugo generates static HTML at build time,
nowreflects the build date — not the visitor's actual date. To handle this, Hugo renders all events upcoming as of the last build, and a small inline script removes any that have since passed using the browser's real current date. The script only runs on this page and does not affect/events.If no cards remain after JS filtering, a fallback message with a link to
/eventsis shown. Since Hugo can't know at build time whether all cards will be removed, this fallback is hidden by default and revealed by JS when needed.🛠️ Implementation Plan
Create
content/events/upcoming/_index.mdSimilar to
content/events/_index.md— setlayout: upcoming-eventsandtitle: "Upcoming Events".Create
layouts/_default/upcoming-events.htmlModel the structure on
layouts/_default/events.html. Use Hugo to filter events upcoming as of build time:{{ $today := time.AsTime (now.Format "2006-01-02") }} {{ $upcoming := (where (where .Site.RegularPages "Section" "events") ".Date" "ge" $today).ByDate }}Render each card with a
data-dateattribute on the wrapping<a>:Include a hidden fallback message (e.g.
display: none) with a link to/eventsfor when no cards remain.Add an inline script that runs on page load:
[data-date]cards whose date is before todayVerify with
hugo serverthat:✅ Acceptance Criteria
/events/upcomingrenders upcoming events sorted soonest-firstdata-dateattribute/eventsare shown/eventsand other pages are unaffected