Skip to content

Add upcoming events page #669

@AJaccP

Description

@AJaccP

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

  1. Create content/events/upcoming/_index.md

    Similar to content/events/_index.md — set layout: upcoming-events and title: "Upcoming Events".

  2. 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.

  3. 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
  4. 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

  • /events/upcoming renders upcoming events sorted soonest-first
  • Each event card has a data-date attribute
  • Events that have passed since the last build are removed on page load
  • When no upcoming events remain, the fallback message and link to /events are shown
  • /events and other pages are unaffected
  • Page style is consistent with the rest of the events section

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions