Changeset 097da22 in Klonkt for src/views/pages/search.ejs


Ignore:
Timestamp:
06/21/2026 05:26:47 PM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
fefb80c
Parents:
e579a98
Message:

feat(zoeken): live results while typing + search in events & pages

  • /search/suggest JSON endpoint; overlay shows live (debounced) grouped results while typing, with "all results →" to the full page.
  • Sources expanded: in addition to posts + tracks now also calendar events (shows: city/location/country/note, if the calendar is enabled) and site pages (Agenda/Downloads/Links/Press Kit/Archive, only those available). Full search page shows those sections too. NL/EN/DE.
  • Overlay placeholder now translated (was hardcoded NL).

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/views/pages/search.ejs

    re579a98 r097da22  
    11<% const _base = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : ''; %>
    22<% const _tracks = (typeof tracks !== 'undefined' && tracks) ? tracks : []; %>
     3<% const _events = (typeof events !== 'undefined' && events) ? events : []; %>
     4<% const _pages = (typeof pages !== 'undefined' && pages) ? pages : []; %>
    35<div class="container search-page">
    46  <h1><%= t('nav.search') %></h1>
     
    8991  <% } %>
    9092
    91   <% if (query && !queryError && !results.length && !_tracks.length) { %>
     93  <% if (_events.length) { %>
     94    <h2 class="search-section-title"><%= t('search.section_events') %></h2>
     95    <ol class="search-results">
     96      <% _events.forEach(function(ev) { %>
     97        <li class="search-result">
     98          <h3 class="search-result-title"><a href="<%= ev.url %>"><%= ev.where || '—' %></a></h3>
     99          <p class="search-result-meta"><%= [ev.date, ev.time].filter(Boolean).join(' ') %></p>
     100        </li>
     101      <% }); %>
     102    </ol>
     103  <% } %>
     104
     105  <% if (_pages.length) { %>
     106    <h2 class="search-section-title"><%= t('search.section_pages') %></h2>
     107    <ul class="search-pages">
     108      <% _pages.forEach(function(pg) { %>
     109        <li><a class="search-page-link" href="<%= pg.url %>"><%= pg.label %> <span aria-hidden="true">→</span></a></li>
     110      <% }); %>
     111    </ul>
     112  <% } %>
     113
     114  <% if (query && !queryError && !results.length && !_tracks.length && !_events.length && !_pages.length) { %>
    92115    <p class="search-empty"><%= t('search.empty') %></p>
    93116  <% } %>
     
    211234  border-radius: 3px;
    212235}
     236.search-pages { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
     237.search-page-link {
     238  display: inline-flex; align-items: center; gap: 0.3rem;
     239  padding: 0.45rem 0.8rem; border: 1px solid var(--rule); border-radius: 999px;
     240  color: var(--ink); text-decoration: none; font-size: 0.9rem; background: var(--paper-2);
     241}
     242.search-page-link:hover { border-color: var(--accent); color: var(--accent); }
    213243</style>
Note: See TracChangeset for help on using the changeset viewer.