<% layout('layouts/boilerplate')%>
    <div id="cluster-map"></div>
    <div class="container">
        <h1>All Holygrounds</h1>

        <% for (let holyground of holygrounds){%>
            <div class="card mb-3">
                <div class="row">
                    <div class="col-md-4">
                        <%if(holyground.images.length) {%>
                            <img class="img-fluid" alt="" src="<%=holyground.images[0].url%>">
                            <% }else {%>
                                <img class="img-fluid" alt=""
                                    src="https://res.cloudinary.com/douqbebwk/image/upload/v1600103881/HolyGround/lz8jjv2gyynjil7lswf4.png">
                                <% } %>
                    </div>
                    <div class="col-md-8">
                        <div class="card-body">
                            <h5 class="card-title">
                                <%= holyground.title %>
                            </h5>
                            <p class="card-text">
                                <%= holyground.description %>
                            </p>
                            <p class="card-text">
                                <small class="text-muted">
                                    <%= holyground.location%>
                                </small>
                            </p>
                            <a class="btn btn-primary" href="/holygrounds/<%=holyground._id%>">View
                                <%=holyground.title%>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
            <% }%>
    </div>
    <script>
        const mapToken = '<%-process.env.MAPBOX_TOKEN%>';
        const holygrounds = '<%-JSON.stringify(features) %>';
    </script>

    <script src="/javascripts/clusterMap.js"></script>