<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Open Graph -->
    <meta property="og:url" content="https://example.com/testsite">
    <meta property="og:type" content="website">
    <meta property="og:title" content="My Website">
    <meta property="og:description" content="Description for my website.">
    <meta property="og:image" content="https://example.com/testsite/img/apple.jpg">

    <!-- Bootstrap -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">

    <!-- JSON Feed -->
    <link href="https://example.com/feed.json" rel="alternate" type="application/feed+json" title="My Website">

    <!-- Styles -->
    <link rel="stylesheet" href="styles.css">

    <title>My Website</title>
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-md">

        <h1>My Website</h1>

        <p>Hello, welcome to my website about fruits and vegetables. More information is available on the <a href="about.html">About</a> page. Use the <a href="contact.html">Contact</a> page to reach me.</p>

        <h2>All posts not sorted</h2>
        <ul>
        {% for post in posts %}
            <li><a href="{{ post.link }}">{{ post.title }}</a> &ensp; {{ post.date }}</li>
        {% endfor %}
        </ul>

        <h2>All posts sorted by date</h2>
        <ul>
        {% for post in posts | sort(attribute='iso_date', reverse=true) %}
            <li><a href="{{ post.link }}">{{ post.title }}</a> &ensp; {{ post.date }}</li>
        {% endfor %}
        </ul>

        <h2>Recent three posts sorted by date</h2>
        <ul>
        {% for post in posts | sort(attribute='iso_date', reverse=true) %}
        {% if loop.index0 < 3 %}
            <li><a href="{{ post.link }}">{{ post.title }}</a></li>
        {% endif %}
        {% endfor %}
        </ul>

        <h2>Posts by category</h2>
        <h4>Fruits</h4>
        <ul>
        {% for post in posts | sort(attribute='category,title') %}
        {% if post.category == 'fruits' %}
            <li><a href="{{ post.link }}">{{ post.title }}</a></li>
        {% endif %}
        {% endfor %}
        </ul>

        <h4>Veggies</h4>
        <ul>
        {% for post in posts | sort(attribute='category,title') %}
        {% if post.category == 'veggies' %}
            <li><a href="{{ post.link }}">{{ post.title }}</a></li>
        {% endif %}
        {% endfor %}
        </ul>

        </div>
    </div>
</div>
</body>
</html>
