<!DOCTYPE html>
<%- include("./snippets/timon.ejs") %>
<html lang="de-ch" data-theme="light">
    <head>
        <%- include("./snippets/head.ejs", {
            title: title,
            date: date,
            desc: desc,
            url: url,
            env: env,
            sitetype: sitetype
        }) %>
    </head>
    <body>
        <%- include("./snippets/header.ejs") %>
        <%- include("./snippets/nav.ejs") %>
        <main><% 
            news.forEach((element, i) => { %>
            <%- include("./snippets/news.ejs", {
                news_title: toRealDate(element.date).split(" um ")[0],
                text: element.text,
                img_path: element.img_path,
                img_alt: element.img_alt,
                img_pos: element.img_pos,
                cta: element.btn,
                cta_text: element.btn_text,
                cta_link: element.btn_link,
                pdf: element.pdf,
                pdf_src: element.pdf_src,
                origin_url: origin_url
            }) %><%
            if (count > 5 && i === news.length - 5) { %>
            <div id="scroll_to_last_entry"></div>
            <% }
            }); %>
            <% if (count === news.length) { %>
            <a class="news-more" href="<%= `/archiv?count=${count + 5}` %>">Weitere</a>
            <% }; %>
            <script defer>
                let count = "<%= count %>";
                count = Number(count);

                if (count > 5 && getQuery("main").get(0).childrenCount() > 5) {
                    scrollToQuery("#scroll_to_last_entry");
                };
            </script>
        </main>
        <%- include("./snippets/footer.ejs", {
            origin_url: origin_url,
            js: js
        }) %>
    </body>
</html>