{% load djinsight_tags %}
<!DOCTYPE html>
<html>
<head>
    <title>Blog - Posts</title>
    <style>
        body { font-family: sans-serif; max-width: 800px; margin: 40px auto; padding: 0 20px; }
        h1 { color: #333; }
        ul { list-style: none; padding: 0; }
        li { padding: 10px 0; border-bottom: 1px solid #eee; }
        a { color: #007bff; text-decoration: none; }
        a:hover { text-decoration: underline; }
        .meta { color: #666; font-size: 0.9em; }
        .views { background: #e9ecef; padding: 2px 8px; border-radius: 4px; font-size: 0.8em; }
    </style>
</head>
<body>
    <h1>Blog Posts</h1>

    {% if posts %}
        <ul>
        {% for post in posts %}
            <li>
                <a href="{{ post.get_absolute_url }}">{{ post.title }}</a>
                <span class="meta">({{ post.created_at|date:"Y-m-d" }})</span>
                <span class="views">Views: {% stats obj=post %}</span>
            </li>
        {% endfor %}
        </ul>
    {% else %}
        <p>No posts yet. <a href="/admin/blog/post/add/">Create one in admin</a>.</p>
    {% endif %}

    <hr>
    <p><a href="/admin/">Admin Panel</a></p>
</body>
</html>
