重做文章详情页:拾光阅读版式与目录/代码/灯箱交互

- 新增内容页外壳 base_content.html 与 reading.css / reading.js
- 重写 post_detail.html:分类胶囊、阅读进度、首字下沉、代码块复制、
  侧栏目录、上下篇、图片灯箱、明暗主题
- post_detail 视图补充上下篇、字数与阅读时长
- base.html 补 extra_css / extra_js block,修复脑图详情页样式不加载
- 加入 mindmaps、api、首页静态资源与模板
- 忽略 __pycache__ / *.pyc / *.back,并将已跟踪的 .pyc 移出版本库
This commit is contained in:
2026-11-20 15:37:55 +08:00
parent 7e45fa620e
commit 6ab9cca4f3
70 changed files with 26103 additions and 38 deletions
+82 -27
View File
@@ -1,33 +1,88 @@
{% extends "base.html" %}
{% load static %}
{% extends "base_content.html" %}
{% block title %}{{ post.title }} - 人,是一根会思考的芦苇{% endblock %}
{% block title %}{{ post.title }} · 拾光{% endblock %}
{% block description %}{{ post.title }}{% endblock %}
{% block content %}
<article>
<h1>{{ post.title }}</h1>
<div class="article-meta">
<span>{{ post.published_at|date:"Y年m月d日 H:i" }}</span>
{% if post.category %}
<span><a href="/category/{{ post.category.slug }}/" style="color: var(--text-muted); text-decoration: none;">{{ post.category.name }}</a></span>
{% endif %}
</div>
<article class="article">
<div class="post-body">
{{ post.content|safe }}
</div>
<header class="article-head">
{% if post.categories.all %}
<div class="article-cats">
{% for cat in post.categories.all %}
<a class="cat-chip" href="{{ cat.get_absolute_url }}">{{ cat.name }}</a>
{% endfor %}
</div>
{% endif %}
{% if post.tags.all %}
<div class="tags">
🏷
{% for tag in post.tags.all %}
<a href="/tag/{{ tag.slug }}/">{{ tag.name }}</a>
{% endfor %}
</div>
{% endif %}
<h1 class="article-title">{{ post.title }}</h1>
<div style="margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--text-muted); font-family: -apple-system, 'Noto Sans SC', sans-serif;">
<a href="/" style="color: var(--text-light); text-decoration: none;">← 返回首页</a>
</div>
</article>
{% endblock %}
{% if post.excerpt %}
<p class="article-lede">{{ post.excerpt|striptags }}</p>
{% endif %}
<div class="article-meta">
<span class="meta-item">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"
stroke-linecap="round" aria-hidden="true">
<rect x="3.5" y="5" width="17" height="15.5" rx="3"/>
<path d="M8 3.5v3M16 3.5v3M3.5 10h17"/>
</svg>
{{ post.published_at|date:"Y年n月j日" }}
</span>
<i class="dot" aria-hidden="true"></i>
<span class="meta-item">{{ char_count }} 字</span>
<i class="dot" aria-hidden="true"></i>
<span class="meta-item">约 {{ read_minutes }} 分钟读完</span>
</div>
<div class="article-orn" aria-hidden="true"><i></i><b>❋</b><i></i></div>
</header>
<!-- 窄屏折叠目录(内容由 reading.js 生成) -->
<details class="toc-mobile" id="tocMobile" hidden>
<summary>本篇目录</summary>
<ol class="toc-list"></ol>
</details>
<div class="article-card">
<div class="post-body" id="postBody">
{{ post.content|safe }}
</div>
{% if post.tags.all %}
<div class="article-tags">
<span class="tags-label">❋ 拾遗</span>
{% for tag in post.tags.all %}
<a class="tag-chip" href="{% url 'blog:tag_detail' slug=tag.slug %}"># {{ tag.name }}</a>
{% endfor %}
</div>
{% endif %}
</div>
<nav class="pager" aria-label="上一篇 / 下一篇">
{% if prev_post %}
<a class="pager-item prev" href="{{ prev_post.get_absolute_url }}" data-nav="prev">
<span class="pager-k">← 上一篇</span>
<span class="pager-t">{{ prev_post.title }}</span>
</a>
{% else %}
<span class="pager-item is-empty" aria-hidden="true"></span>
{% endif %}
{% if next_post %}
<a class="pager-item next" href="{{ next_post.get_absolute_url }}" data-nav="next">
<span class="pager-k">下一篇 →</span>
<span class="pager-t">{{ next_post.title }}</span>
</a>
{% else %}
<span class="pager-item is-empty" aria-hidden="true"></span>
{% endif %}
</nav>
<div class="article-foot">
<a class="btn-back" href="/">← 返回思维导航</a>
<span class="foot-note">字句织网 · 思绪成图</span>
</div>
</article>
{% endblock %}