blog_post.html.bak

← Back to explorer
templates/blog_post.html.bak
{% extends "base.html" %}

{% block title %}{{ post.title }} · Blog{% endblock %}

{% block head %}
  <link rel="stylesheet" href="{{ url_for('static', filename='css/blog_page.css') }}">
  <link rel="stylesheet" href="{{ url_for('static', filename='css/code-highlighting.css') }}">
{% endblock %}

{% block content %}
  <div class="blog-post-container">
    <div class="blog-post">
      <div class="blog-post-header">
        <div class="blog-post-header-top">
          <div class="blog-post-title-section">
            <h1>{{ post.title }}</h1>

            <div class="blog-post-meta">
              {% if post.published_at %}
                <span class="blog-post-date">{{ post.published_at.strftime('%d %b %Y') }}</span>
              {% endif %}

              {% if post.tags and post.tags|length > 0 %}
                <div class="blog-item-tags">
                  {% for t in post.tags %}
                    <a class="blog-tag" data-tag="{{ t|lower }}" href="{{ url_for('blog_index', tag=t) }}">{{ t }}</a>
                  {% endfor %}
                </div>
              {% endif %}
            </div>
          </div>

          <div class="blog-actions">
            <input type="hidden" id="postId" value="{{ post.id }}">
            <button class="blog-action-btn" id="likeBtn" data-liked="{{ 1 if has_liked else 0 }}" type="button">
              👍 <span id="likeCount">{{ like_count }}</span>
            </button>
            <button class="blog-action-btn" id="copyLinkBtn" type="button">🔗</button>
          </div>
        </div>
      </div>

      {% if post.cover_image %}
        <div class="blog-cover">
          <img src="{{ url_for('static', filename='uploads/' + post.cover_image) }}" alt="{{ post.title }}">
        </div>
      {% endif %}

      <div class="blog-content">
        {{ post.content_html | safe }}
      </div>

      {% if images and images|length > 0 %}
        <div class="blog-gallery">
          {% for im in images %}
            <figure class="blog-gallery-item">
              <img src="{{ url_for('static', filename='uploads/' + im.filename) }}" alt="{{ post.title }}">
            </figure>
          {% endfor %}
        </div>
      {% endif %}

      <div class="blog-comments">
        <h2 class="blog-comments-header">Comments</h2>

        <form id="commentForm" class="comment-form">
          <input name="display_name" placeholder="Name (optional)" maxlength="40">
          <textarea name="content" placeholder="Write a comment..." maxlength="2000" required></textarea>
          <div class="comment-form-actions">
            <button type="submit">Post comment</button>
            <span id="commentError" class="comment-error"></span>
          </div>
        </form>

        {% if comments|length == 0 %}
          <p class="comment-empty">No comments yet. Be the first to comment!</p>
        {% else %}
          <div class="comment-list">
            {% for c in comments %}
              <div class="comment">
                <div class="comment-header">
                  <span class="comment-author">{{ c.display_name }}</span>
                  <span class="comment-date">{{ c.created_at.strftime('%d %b %Y, %H:%M') }}</span>
                </div>
                <p class="comment-text">{{ c.content }}</p>
              </div>
            {% endfor %}
          </div>
        {% endif %}
      </div>
    </div>
  </div>

  <script src="{{ url_for('static', filename='js/blog.js') }}"></script>
{% endblock %}