重做文章详情页:拾光阅读版式与目录/代码/灯箱交互
- 新增内容页外壳 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:
@@ -42,6 +42,13 @@
|
||||
padding: 0 1.5rem;
|
||||
}
|
||||
|
||||
|
||||
.container-wide {
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
padding: 0 1.5rem;
|
||||
}
|
||||
|
||||
/* ===== 头部 ===== */
|
||||
header {
|
||||
padding: 3rem 0 2rem;
|
||||
@@ -256,6 +263,7 @@
|
||||
article h1 { font-size: 1.35rem; }
|
||||
}
|
||||
</style>
|
||||
{% block extra_css %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
@@ -264,6 +272,7 @@
|
||||
<nav>
|
||||
<a href="/">首页</a>
|
||||
<a href="/archive/">归档</a>
|
||||
<a href="/mindmaps/">脑图</a>
|
||||
<a href="/about/">关于</a>
|
||||
</nav>
|
||||
</header>
|
||||
@@ -276,6 +285,9 @@
|
||||
<p>© 2024 郭安的小站 · 用 Django 构建</p>
|
||||
</footer>
|
||||
</div>
|
||||
<div class="container-wide">
|
||||
{% block wide_content %}{% endblock %}
|
||||
</div>
|
||||
|
||||
<!-- highlight.js 核心脚本 -->
|
||||
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.9.0/build/highlight.min.js"></script>
|
||||
@@ -286,5 +298,6 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% block extra_js %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,197 @@
|
||||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN" data-theme="light">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
|
||||
<title>思维导航 · 我的博客</title>
|
||||
<!-- <link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> -->
|
||||
<!-- <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@500;700;900&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400&display=swap" rel="stylesheet"> -->
|
||||
<link rel="preconnect" href="https://fonts.loli.net">
|
||||
<link rel="preconnect" href="https://gstatic.loli.net" crossorigin>
|
||||
<link href="https://fonts.loli.net/css2?family=Noto+Serif+SC:wght@500;700;900&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400&display=swap" rel="stylesheet">
|
||||
<!-- 全局基础样式(项目级) -->
|
||||
<link rel="stylesheet" href="{% static 'blog/css/style.css' %}">
|
||||
<!-- 让子模板可以追加自己的 CSS -->
|
||||
{% block extra_css %}{% endblock %}
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<!-- 🎬 开场引导层:道生一,一生二,二生三,三生万物
|
||||
自动约 4.6s,点击任意处 / 任意键 / 跳过按钮可提前结束 -->
|
||||
<div class="intro" id="intro" role="dialog" aria-label="欢迎">
|
||||
<div class="intro-inner">
|
||||
<div class="intro-seed">
|
||||
<svg class="seed-svg" viewBox="0 0 240 240" fill="none" aria-hidden="true">
|
||||
<defs>
|
||||
<!-- 渐变色全部由 CSS 变量控制,深浅主题自动适配 -->
|
||||
<linearGradient id="sgVine" x1="120" y1="200" x2="120" y2="40" gradientUnits="userSpaceOnUse">
|
||||
<stop class="sgVine-a" offset="0"/>
|
||||
<stop class="sgVine-b" offset="1"/>
|
||||
</linearGradient>
|
||||
<radialGradient id="sgNode" cx=".35" cy=".35" r=".85">
|
||||
<stop class="sgNode-a" offset="0"/>
|
||||
<stop class="sgNode-b" offset="1"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="sgRoot" cx=".4" cy=".4" r=".8">
|
||||
<stop class="sgRoot-a" offset="0"/>
|
||||
<stop class="sgRoot-b" offset=".55"/>
|
||||
<stop class="sgRoot-c" offset="1"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="sgHalo">
|
||||
<stop class="sgHalo-a" offset="0"/>
|
||||
<stop class="sgHalo-b" offset="1"/>
|
||||
</radialGradient>
|
||||
</defs>
|
||||
|
||||
<!-- ✦ 缓旋虚线轨道:包裹整个生成的宇宙 -->
|
||||
<g class="orbit">
|
||||
<circle cx="120" cy="126" r="106" pathLength="1"/>
|
||||
</g>
|
||||
|
||||
<!-- ✦ 根部(道)的呼吸光晕与声呐 -->
|
||||
<circle class="halo" cx="120" cy="192" r="24"/>
|
||||
<circle class="sonar s-a" cx="120" cy="192" r="12"/>
|
||||
<circle class="sonar s-b" cx="120" cy="192" r="12"/>
|
||||
|
||||
<!-- ✦ 道生一:无形中生出第一缕有 -->
|
||||
<path class="sl g1" id="sgP1" pathLength="1" d="M120 192 C 120 178 120 164 120 152"/>
|
||||
|
||||
<!-- ✦ 一生二:阴阳两仪 -->
|
||||
<path class="sl g2" id="sgP2a" pathLength="1" d="M120 152 C 108 138 96 126 86 114"/>
|
||||
<path class="sl g2" pathLength="1" d="M120 152 C 132 138 144 126 154 114"/>
|
||||
|
||||
<!-- ✦ 二生三:冲气以为和,三才既立 -->
|
||||
<path class="sl g3" pathLength="1" d="M86 114 C 76 102 68 92 62 80"/>
|
||||
<path class="sl g3" id="sgP3" pathLength="1" d="M120 138 C 134 126 132 104 120 86"/>
|
||||
<path class="sl g3" pathLength="1" d="M154 114 C 164 102 172 92 178 80"/>
|
||||
|
||||
<!-- ✦ 三生万物:九枝散叶,生生不息 -->
|
||||
<path class="twig tw1" pathLength="1" d="M62 80 C 56 72 50 66 44 58"/>
|
||||
<path class="twig tw2" pathLength="1" d="M62 80 C 62 70 60 62 58 52"/>
|
||||
<path class="twig tw3" pathLength="1" d="M62 80 C 68 72 72 64 76 58"/>
|
||||
<path class="twig tw4" pathLength="1" d="M120 84 C 114 74 108 66 104 60"/>
|
||||
<path class="twig tw5" pathLength="1" d="M120 84 C 120 74 120 64 120 54"/>
|
||||
<path class="twig tw6" pathLength="1" d="M120 84 C 126 74 132 66 136 60"/>
|
||||
<path class="twig tw7" pathLength="1" d="M178 80 C 184 72 190 66 196 58"/>
|
||||
<path class="twig tw8" pathLength="1" d="M178 80 C 178 70 180 62 182 52"/>
|
||||
<path class="twig tw9" pathLength="1" d="M178 80 C 172 72 168 64 164 58"/>
|
||||
|
||||
<!-- ✦ 光尘:散落的时光正被拾起 -->
|
||||
<circle class="dust" cx="70" cy="170" r="1.2" style="animation-delay:.9s"/>
|
||||
<circle class="dust" cx="176" cy="150" r="1" style="animation-delay:2.2s"/>
|
||||
<circle class="dust" cx="48" cy="100" r="1.1" style="animation-delay:3.3s"/>
|
||||
<circle class="dust" cx="196" cy="96" r=".9" style="animation-delay:3.9s"/>
|
||||
|
||||
<!-- ✦ 流光:沿生成之路巡游的光点 -->
|
||||
<circle class="spark" r="2.4">
|
||||
<animateMotion dur="2.4s" begin="1s" repeatCount="indefinite"><mpath href="#sgP1"/></animateMotion>
|
||||
</circle>
|
||||
<circle class="spark" r="2">
|
||||
<animateMotion dur="2.6s" begin="2.1s" repeatCount="indefinite"><mpath href="#sgP2a"/></animateMotion>
|
||||
</circle>
|
||||
<circle class="spark" r="1.8">
|
||||
<animateMotion dur="2.4s" begin="2.8s" repeatCount="indefinite"><mpath href="#sgP3"/></animateMotion>
|
||||
</circle>
|
||||
|
||||
<!-- ✦ 节点:道 → 一 → 二(阴/阳)→ 三 -->
|
||||
<circle class="sn root" cx="120" cy="192" r="8"/>
|
||||
<circle class="sn n1" cx="120" cy="152" r="5.5"/>
|
||||
<circle class="sn n2 yin" cx="86" cy="114" r="5"/>
|
||||
<circle class="sn n2 yang" cx="154" cy="114" r="5"/>
|
||||
<circle class="sn n3" cx="62" cy="80" r="4.5"/>
|
||||
<circle class="sn n3" cx="120" cy="86" r="4.5"/>
|
||||
<circle class="sn n3" cx="178" cy="80" r="4.5"/>
|
||||
|
||||
<!-- ✦ 万物之叶 -->
|
||||
<circle class="lf lf1" cx="44" cy="58" r="2.4"/>
|
||||
<circle class="lf lf2" cx="58" cy="52" r="2.4"/>
|
||||
<circle class="lf lf3" cx="76" cy="58" r="2.4"/>
|
||||
<circle class="lf lf4" cx="104" cy="60" r="2.4"/>
|
||||
<circle class="lf lf5" cx="120" cy="54" r="2.4"/>
|
||||
<circle class="lf lf6" cx="136" cy="60" r="2.4"/>
|
||||
<circle class="lf lf7" cx="164" cy="58" r="2.4"/>
|
||||
<circle class="lf lf8" cx="182" cy="52" r="2.4"/>
|
||||
<circle class="lf lf9" cx="196" cy="58" r="2.4"/>
|
||||
|
||||
<!-- ✦ 节点铭文 -->
|
||||
<text class="lbl l-dao" x="120" y="216" text-anchor="middle">道</text>
|
||||
<text class="lbl l-yi" x="133" y="156">一</text>
|
||||
<text class="lbl l-er" x="120" y="103" text-anchor="middle">二</text>
|
||||
<text class="lbl l-san" x="136" y="78">三</text>
|
||||
<text class="lbl l-wan" x="120" y="38" text-anchor="middle">万物</text>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="tao-phase" aria-hidden="true">
|
||||
<span>道生一</span><span>一生二</span><span>二生三</span><span>三生万物</span>
|
||||
</div>
|
||||
<h1 class="intro-title">拾光</h1>
|
||||
<p class="intro-sub">把每一次思考 · 织成会生长的网</p>
|
||||
<div class="intro-divider" aria-hidden="true"><i></i><b>✦</b><i></i></div>
|
||||
<div class="intro-stats">
|
||||
<div class="stat"><b data-stat="posts">{{total_posts}}</b><span>篇文章</span></div>
|
||||
<div class="stat"><b data-stat="cats">{{total_categories}}</b><span>大分类</span></div>
|
||||
<div class="stat"><b data-stat="subs">{{mindmap_count}}</b><span>知识图谱</span></div>
|
||||
</div>
|
||||
<div class="intro-progress"><i></i></div>
|
||||
<p class="intro-hint">正在展开思维图谱</p>
|
||||
</div>
|
||||
<button class="intro-skip" id="btnSkipIntro">跳过 SKIP →</button>
|
||||
</div>
|
||||
|
||||
<div class="aurora"><div class="blob-c"></div></div>
|
||||
<header>
|
||||
<div class="brand">
|
||||
<div class="brand-mark">思</div>
|
||||
<div class="brand-text">
|
||||
<h1>拾光</h1>
|
||||
<p>MIND MAP · BLOG</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="top-actions">
|
||||
<button class="icon-btn" id="btnSearch" title="搜索 (Ctrl+K)">⌕</button>
|
||||
<button class="icon-btn" id="btnTheme" title="切换主题">◐</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="search-box" id="searchBox">
|
||||
<span style="color:var(--ink-faint); font-size:13px;">⌕</span>
|
||||
<input id="searchInput" type="text" placeholder="搜索分类或文章…">
|
||||
<kbd>ESC</kbd>
|
||||
</div>
|
||||
|
||||
<div id="mindmap-wrap"><svg id="mindmap"></svg></div>
|
||||
|
||||
<div class="toolbar">
|
||||
<button class="icon-btn" id="btnFit" title="自适应">⛶</button>
|
||||
<button class="icon-btn" id="btnIn" title="放大">+</button>
|
||||
<button class="icon-btn" id="btnOut" title="缩小">-</button>
|
||||
<button class="icon-btn" id="btnFs" title="全屏">❐</button>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<span>© 2026 我的博客</span>
|
||||
<span class="dot"></span>
|
||||
<span>共 18 篇文章</span>
|
||||
<span class="dot"></span>
|
||||
<span>Powered by xiaoan</span>
|
||||
</footer>
|
||||
|
||||
|
||||
<script src="{% static 'blog/js/d3.min.js' %}"></script>
|
||||
<script src="{% static 'blog/js/index.js' %}"></script>
|
||||
<script src="{% static 'blog/js/index.iife.js' %}"></script>
|
||||
<!-- <script src="https://cdn.jsdelivr.net/npm/d3@7/dist/d3.min.js"></script> -->
|
||||
<!-- <script src="https://cdn.jsdelivr.net/npm/markmap-view@0.18.10/dist/browser/index.js"></script> -->
|
||||
<!-- <script src="https://cdn.jsdelivr.net/npm/markmap-lib@0.18.12/dist/browser/index.iife.js"></script> -->
|
||||
|
||||
<!-- <script src="https://cdn.jsdmirror.com/npm/d3@7/dist/d3.min.js"></script>
|
||||
<script src="https://cdn.jsdmirror.com/npm/markmap-view@0.18.10/dist/browser/index.js"></script>
|
||||
<script src="https://cdn.jsdmirror.com/npm/markmap-lib@0.18.12/dist/browser/index.iife.js"></script> -->
|
||||
<script type="module" src="{% static 'blog/js/main.js' %}"></script>
|
||||
<!-- 让子模板可以追加自己的 JS -->
|
||||
{% block extra_js %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,73 @@
|
||||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN" data-theme="light">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
|
||||
<meta name="color-scheme" content="light dark">
|
||||
<title>{% block title %}拾光{% endblock %}</title>
|
||||
<meta name="description" content="{% block description %}把每一次思考 · 织成会生长的网{% endblock %}">
|
||||
|
||||
<!-- 主题预置:在样式生效前定好明暗,避免闪烁(键名与首页一致) -->
|
||||
<script>
|
||||
(function () {
|
||||
var t = 'light';
|
||||
try { t = localStorage.getItem('theme') || 'light'; } catch (e) {}
|
||||
document.documentElement.dataset.theme = (t === 'dark') ? 'dark' : 'light';
|
||||
})();
|
||||
</script>
|
||||
|
||||
<link rel="preconnect" href="https://fonts.loli.net">
|
||||
<link rel="preconnect" href="https://gstatic.loli.net" crossorigin>
|
||||
<link href="https://fonts.loli.net/css2?family=Noto+Serif+SC:wght@500;600;700;900&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="{% static 'blog/css/reading.css' %}">
|
||||
<!-- 代码高亮(深色代码块配套主题) -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.9.0/build/styles/github-dark.min.css">
|
||||
{% block extra_css %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
<a class="skip-link" href="#article">跳到正文</a>
|
||||
|
||||
<div class="page-glow" aria-hidden="true"><i></i><i></i><i></i></div>
|
||||
<div class="read-progress" id="readProgress" aria-hidden="true"><i></i></div>
|
||||
|
||||
<header class="site-head" id="siteHead">
|
||||
<a class="brand" href="/" aria-label="拾光 · 返回思维导航">
|
||||
<span class="brand-mark" aria-hidden="true">思</span>
|
||||
<span class="brand-text">
|
||||
<b>拾光</b>
|
||||
<small>MIND MAP · READING</small>
|
||||
</span>
|
||||
</a>
|
||||
<div class="head-actions">
|
||||
<a class="btn-map" href="/" title="返回思维导图">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7"
|
||||
stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<path d="M19 12H5M11 6l-6 6 6 6"/>
|
||||
</svg>
|
||||
<span>返回导图</span>
|
||||
</a>
|
||||
<button class="icon-btn" id="btnTheme" type="button" aria-label="切换明暗主题" title="切换主题(明 / 暗)">◐</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="reading" id="article">
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
|
||||
<!-- 侧栏目录:由 reading.js 根据正文标题生成 -->
|
||||
<aside class="toc" id="toc" hidden aria-label="本篇目录">
|
||||
<p class="toc-title"><span>✦</span>本篇目录</p>
|
||||
<ol class="toc-list"></ol>
|
||||
</aside>
|
||||
|
||||
<footer class="site-foot">
|
||||
<p>© 2026 拾光<span class="dot"></span>字句织网 · 思绪成图</p>
|
||||
</footer>
|
||||
|
||||
<script defer src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.9.0/build/highlight.min.js"></script>
|
||||
<script src="{% static 'blog/js/reading.js' %}"></script>
|
||||
{% block extra_js %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,148 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ mindmap.title }}{% endblock %}
|
||||
|
||||
{% block extra_css %}
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/simple-mind-map@0.10.0/dist/style.css" />
|
||||
<style>
|
||||
#mindmap-wrapper {
|
||||
position: relative;
|
||||
margin-top: 1.5rem;
|
||||
width: 100vw;
|
||||
margin-left: calc(-50vw + 50%);
|
||||
}
|
||||
#mindmap-container {
|
||||
width: 100% !important;
|
||||
height: 90vh !important;
|
||||
min-height: 700px !important;
|
||||
border: 1px solid #e0e0e0;
|
||||
border-radius: 6px;
|
||||
display: block !important;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
#mindmap-container svg {
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
#fullscreen-btn {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
z-index: 100;
|
||||
padding: 6px 14px;
|
||||
background: #333;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
font-family: -apple-system, "Noto Sans SC", sans-serif;
|
||||
}
|
||||
|
||||
#fullscreen-btn:hover {
|
||||
background: #555;
|
||||
}
|
||||
|
||||
#mindmap-container:fullscreen {
|
||||
width: 100vw !important;
|
||||
height: 100vh !important;
|
||||
border-radius: 0;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block wide_content %}
|
||||
<h1>{{ mindmap.title }}</h1>
|
||||
{% if mindmap.description %}
|
||||
<p style="color: var(--text-light); margin-bottom: 1rem;">{{ mindmap.description }}</p>
|
||||
{% endif %}
|
||||
|
||||
<div id="mindmap-wrapper">
|
||||
<button id="fullscreen-btn">全屏</button>
|
||||
<div id="mindmap-container"></div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/simple-mind-map@0.10.0/dist/simpleMindMap.umd.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
function init() {
|
||||
var el = document.getElementById('mindmap-container');
|
||||
if (!el) return;
|
||||
|
||||
// ✅ 强制容器尺寸先生效
|
||||
el.style.width = '100%';
|
||||
el.style.height = '90vh';
|
||||
el.style.display = 'block';
|
||||
|
||||
// ✅ 等一帧让浏览器 reflow
|
||||
requestAnimationFrame(function () {
|
||||
// 这时候 el.clientWidth 应该是 1400px 左右了
|
||||
|
||||
var raw = {{ mindmap.mindmap_data|safe }};
|
||||
|
||||
function adapt(node) {
|
||||
if (!node) return null;
|
||||
if (node.topic !== undefined) {
|
||||
var result = { data: { text: node.topic } };
|
||||
if (node.children && node.children.length) {
|
||||
result.children = node.children.map(adapt).filter(Boolean);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
if (node.data && node.data.text) {
|
||||
var result2 = { data: { text: node.data.text } };
|
||||
if (node.children && node.children.length) {
|
||||
result2.children = node.children.map(adapt).filter(Boolean);
|
||||
}
|
||||
return result2;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
var mindData;
|
||||
if (raw.data && raw.data.topic !== undefined) {
|
||||
mindData = adapt(raw.data);
|
||||
} else if (raw.data && raw.data.text) {
|
||||
mindData = adapt(raw);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
var MindMap = window.simpleMindMap && window.simpleMindMap.default;
|
||||
if (!MindMap) return;
|
||||
|
||||
new MindMap({
|
||||
el: el,
|
||||
data: mindData,
|
||||
readonly: true,
|
||||
layout: 'logicalStructure',
|
||||
theme: 'default',
|
||||
scale: 1.5,
|
||||
maxScale: 3,
|
||||
minScale: 0.3,
|
||||
fit: false,
|
||||
center: true
|
||||
});
|
||||
|
||||
// ✅ 初始化完再强制改一次 SVG 尺寸
|
||||
var svg = el.querySelector('svg');
|
||||
if (svg) {
|
||||
svg.style.width = el.clientWidth + 'px';
|
||||
svg.style.height = el.clientHeight + 'px';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// DOM ready 后执行
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
} else {
|
||||
setTimeout(init, 100);
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,14 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<h1>脑图笔记</h1>
|
||||
<ul class="mindmap-list">
|
||||
{% for m in mindmaps %}
|
||||
<li>
|
||||
<a href="{{ m.get_absolute_url }}">{{ m.title }}</a>
|
||||
<p>{{ m.description }}</p>
|
||||
</li>
|
||||
{% empty %}
|
||||
<li>还没有脑图,去后台导入吧。</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
@@ -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 %}
|
||||
|
||||
Reference in New Issue
Block a user