{{ define "styles" }}
    {{ $styles := resources.Get "css/index.css" | toCSS | minify }}

    <link rel="stylesheet" href="{{ $styles.Permalink }}" />
{{ end }}
{{ define "main" }}
    <section id="about">
        <h2>About</h2>
        {{ partial "about-card.html" . }}
    </section>

    {{ if (gt (len (where .Site.RegularPages "Section" "projects")) 0) }}
        <section id="projects">
            <div>
                <h2>Projects</h2>
                <a class="read-more" href="{{ urls.JoinPath .Site.BaseURL "projects" }}">
                    View all projects
                </a>
            </div>
            <p>These are all the projects I worked on personally and professionally.</p>
            {{ range (where .Site.Pages "Section" "projects") }}
                {{ range first 3 .Pages }}
                    {{ partial "card.html" . }}
                {{ end }}
            {{ end }}
        </section>
    {{ end }}
    
    {{ if (gt (len (where .Site.RegularPages "Section" "blog")) 0) }}
        <section id="blog">
            <div>
                <h2>Blog</h2>
                <a class="read-more" href="{{ urls.JoinPath .Site.BaseURL "blog" }}">
                    View all blog posts
                </a>
            </div>
            <p>These are articles about things I learned about software engineering.</p>
            {{ range (where .Site.Pages "Section" "blog") }}
                {{ range first 2 .Pages }}
                    {{ partial "card.html" . }}
                {{ end }}
            {{ end }}
        </section>
    {{ end }}
{{ end }}
