<%# Code for a snapshot of site announcements %>

<% try { %>

    <% let annoucementTest = announcements; %>

    <div class="card">

        <h5 class="card-header text-center">Latest Announcements</h5>

        <div class="card-body">

            <% announcements.forEach((announcement) => { %>
                <div class="my-3">
                    <h6 class="card-title my-1"><%= announcement.title %></h6>
                    <p class="card-text my-1"><small class="text-muted">Posted <%= announcement.date.split('T')[0] %></small></p>
                    <p class="card-text my-1"><%- announcement.text %></p>
                </div>
            <% }); %>

            <h6 class="card-title mt-4 text-center"><a href="/announcements">See more announcements</a></h6>
        </div>
    </div>

<% } catch(err) { %>
    <p class="text-center"><font color="red">[Site component can not be displayed due to an internal error]</font></p>
<% } %>