HTMLify

post.html
Views: 212 | Author: abh
<!-- post.html -->
{% extends "base.html" %}
{% block title %}{{ post.title }}{% endblock %}
{% block meta %}{{ post.meta }}{% endblock %}
{% block body %}
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f0f0f0;
        }

        .post-container {
            display: flex;
            max-width: 1200px;
            margin: 20px auto;
            padding: 20px;
            background-color: #fff;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        .post-content {
            flex: 2;
        }

        h1 {
            font-size: 24px;
            margin-bottom: 10px;
        }

        p {
            font-size: 16px;
            line-height: 1.6;
        }

        .comment-box {
            margin-top: 20px;
            border: 1px solid #ccc;
            padding: 10px;
        }

        .comment-form {
            margin-top: 10px;
        }

        .comment-form label {
            display: block;
            margin-bottom: 5px;
        }

        .comment-form input,
        .comment-form textarea {
            width: 100%;
            padding: 5px;
            margin-bottom: 10px;
        }

        .comment-form button {
            background-color: #007bff;
            color: #fff;
            border: none;
            padding: 8px 15px;
            cursor: pointer;
        }

        .comment-form button:hover {
            background-color: #0056b3;
        }

        .comment-template {
            border: 1px solid #ccc;
            padding: 10px;
            margin-top: 20px;
        }

        .comment-author {
            display: flex;
            align-items: center;
            margin-bottom: 5px;
        }

        .comment-dp {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            margin-right: 10px;
        }

        .comment-name {
            font-weight: bold;
        }

        .comment-content {
            font-size: 14px;
            line-height: 1.4;
        }

        .related-posts {
            flex: 1;
            padding: 0 20px;
            margin-top: 20px;
        }

        .related-post {
            margin-bottom: 15px;
            border-bottom: 1px solid #ccc;
            padding-bottom: 10px;
        }

        .related-post:last-child {
            border-bottom: none;
            margin-bottom: 0;
        }

        .related-post-title {
            font-size: 18px;
            margin-bottom: 5px;
        }

        .related-post-excerpt {
            font-size: 14px;
        }

        @media (max-width: 768px) {
            .post-container {
                flex-direction: column;
            }

            .related-posts {
                margin-top: 0;
            }
        }
    </style>
</head>
<body>
    <div class="post-container">
        <div class="post-content">
            <h1>{{ post.title }}</h1>
            {{ post.content }}


            {% for comment in post.comments %}
            <div id="comment-{{ comment.id }}" class="comment-template">
                <div class="comment-author">
                    <img class="comment-dp" src="{{ comment.dp() }}" alt="User DP">
                    <div class="comment-name">{{ comment.name }}</div>
                </div>
                <div class="comment-content">
                    {{ comment.content }}
                </div>
            </div>
            {% endfor %}
            
            <div class="comment-box">
                <h3>Leave a Comment</h3>
                <form class="comment-form" action="/comments/process" method="POST">
                	<input type="hidden" name="post" value="{{ post.id }}">
                    <label for="name">Name:</label>
                    <input type="text" id="name" name="name" value="{{ session.get("commenter-name", "") }}" required>
					<label for="email">Email:</label>
					<input type="email" id="email" name="email" value="{{ session.get("commenter-email", "") }}" required>
                    <label for="comment">Comment:</label>
                    <textarea id="comment" name="content" rows="4" required></textarea>
            
                    <button type="submit">Submit</button>
                </form>
            </div>
        </div>
		



        <div class="related-posts">
            <h2>Related Posts</h2>
            {% for related_post in related_posts %}
            <div class="related-post">
                <div class="related-post-title">{{ related_post.title }}</div>
                <div class="related-post-excerpt">{{ related_post.meta }}</div>
            </div>
            {% endfor %}
        </div>
    </div>
{% endblock %}

Comments