HTMLify
post.html
Views: 632 | Author: abh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | <!-- 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 %} |