SPB Git

spb/spbgit Public MIT

SPB Git — the platform hosting itself

JavaScript 73.9% CSS 11.7% Nunjucks 11.6% Shell 2.7%
2.5 KB · 57 lines jinja
Raw Blame History
1{#2  ─────────────────────────────────────────────3   SPB Git — Personal Git Platform4  ─────────────────────────────────────────────5   Author  : Simon-Pierre Boucher6   Contact : contact@spboucher.ai7   File    : src/web/views/search.njk8   Purpose : Global search — grouped repo + README results9   License : MIT © Simon-Pierre Boucher10  ─────────────────────────────────────────────11#}{% extends "layout.njk" %}12{% block content %}13<h1 class="section-title">Search</h1>14<form action="/search" method="get" class="search-page-form" role="search">15  <input type="search" name="q" value="{{ q }}" placeholder="Search repositories, topics, READMEs…" aria-label="Search query" autofocus>16  <button class="btn btn-primary" type="submit">Search</button>17</form>1819{% if q %}20<section aria-labelledby="repo-results-h">21  <h2 id="repo-results-h" class="section-title">Repositories <span class="count">{{ results.repos.length }}</span></h2>22  {% if results.repos.length %}23  <ul class="search-results">24    {% for hit in results.repos %}25    <li>26      <a class="search-hit-name" href="/{{ hit.name }}">{{ hit.name }}</a>27      {% if hit.topLanguage %}<span class="lang-dot-label"><span class="lang-dot" style="background:{{ hit.topLanguage | langcolor }}"></span>{{ hit.topLanguage }}</span>{% endif %}28      {% if hit.description %}<p class="muted">{{ hit.description }}</p>{% endif %}29      {% if hit.topics.length %}30      <div class="chip-row">{% for topic in hit.topics %}<span class="chip chip-topic">{{ topic }}</span>{% endfor %}</div>31      {% endif %}32    </li>33    {% endfor %}34  </ul>35  {% else %}36  <p class="muted">No repository matches “{{ q }}”.</p>37  {% endif %}38</section>3940<section aria-labelledby="readme-results-h">41  <h2 id="readme-results-h" class="section-title">README content <span class="count">{{ results.readmes.length }}</span></h2>42  {% if results.readmes.length %}43  <ul class="search-results">44    {% for hit in results.readmes %}45    <li>46      <a class="search-hit-name" href="/{{ hit.name }}">{{ hit.name }}</a>47      <p class="search-snippet">{{ hit.snippet }}</p>48    </li>49    {% endfor %}50  </ul>51  {% else %}52  <p class="muted">No README mentions “{{ q }}”.</p>53  {% endif %}54</section>55{% endif %}56{% endblock %}57