{% extends "base.html" %}
{% block title %}All pages — Wiki{% endblock %}
{% block content %}
{% include "wiki/_layout.html" %}

<div class="bbs-header">
    <h1><i class="bi bi-list-ul"></i> All wiki pages</h1>
    <p class="text-muted">{{ total }} page{{ '' if total == 1 else 's' }}, alphabetical.</p>
</div>

{% if by_letter %}
<p class="wiki-nav">
    {% for ch, _ in by_letter %}
    <a href="#L{{ ch }}">{{ ch }}</a>
    {% endfor %}
</p>

{% for ch, pages in by_letter %}
<div class="card mb-3" id="L{{ ch }}">
    <div class="card-header"><strong>{{ ch }}</strong></div>
    <ul class="list-group list-group-flush">
        {% for p in pages %}
        <li class="list-group-item">
            <a href="{{ url_for('wiki.view', slug=p.slug) }}">{{ p.title }}</a>
            <small class="text-muted">— {{ p.updated_at.strftime('%Y-%m-%d') }}</small>
        </li>
        {% endfor %}
    </ul>
</div>
{% endfor %}
{% else %}
<div class="alert alert-info">No pages yet.</div>
{% endif %}
{% endblock %}
