<% if (links != undefined) { %>
    <% links.forEach(link => { %>
        <% if(link.dropdown) { %>
            <div class="dropdown" style="display: inline;">
                <button class="btn btn-outline-secondary dropdown-toggle <%- link.disabled %>" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                <%= link.name %>
                </button>
                <div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">
                    <% link.links.forEach(sublink => { %>
                        <% if(has_s3_link(sublink, project)) { %>
                            <a class="dropdown-item <%- link.disabled %>" 
                                href="<%= get_s3_link(sublink, project) %>"
                                v-on:click="mixpanelTrack('Download Link', {'file': '<%= get_s3_link(sublink, project) %>', 'project': '<%= project.title %>'})"
                                target="_blank" rel="noopener noreferrer">
                                <%= sublink.name %>
                            </a>      
                        <% } else { %>
                            <a class="dropdown-item <%- link.disabled %>" 
                                href="<%= sublink.url %>"
                                v-on:click="mixpanelTrack('External Link', {'url': '<%= sublink.url %>', 'project': '<%= project.title %>'})"
                                target="_blank" rel="noopener noreferrer">
                                <%= sublink.name %>
                            </a>      
                        <% } %>
                    <% }); %>
                </div>
            </div> 
        <% } else { %>
            <a role="button" class="btn btn-outline-secondary <%- link.disabled %>" 
                href="<%- link.url %>"
                v-on:click="mixpanelTrack('External Link', {'url': '<%= link.url %>', 'project': '<%= project.title %>'})"
                target="_blank" rel="noopener noreferrer">
                <%= link.name %>
            </a>
        <% } %>
    <% }); %>
<% } %>