完成wordpress到django站点的数据迁移,下一届阶段完成前端样式的轻度编写
This commit is contained in:
@@ -0,0 +1,268 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}郭安的小站{% endblock %}</title>
|
||||
<style>
|
||||
/* ===== Reset ===== */
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
/* ===== 基础变量 ===== */
|
||||
:root {
|
||||
--bg: #fefefe;
|
||||
--text: #1a1a1a;
|
||||
--text-light: #6b6b6b;
|
||||
--text-muted: #9b9b9b;
|
||||
--accent: #333333;
|
||||
--border: #e8e8e8;
|
||||
--code-bg: #f6f6f6;
|
||||
--radius: 4px;
|
||||
}
|
||||
|
||||
/* ===== 全局 ===== */
|
||||
body {
|
||||
font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC",
|
||||
"STSong", "Times New Roman", serif;
|
||||
font-size: 17px;
|
||||
line-height: 1.85;
|
||||
color: var(--text);
|
||||
background: var(--bg);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
/* ===== 布局 ===== */
|
||||
.container {
|
||||
max-width: 680px;
|
||||
margin: 0 auto;
|
||||
padding: 0 1.5rem;
|
||||
}
|
||||
|
||||
/* ===== 头部 ===== */
|
||||
header {
|
||||
padding: 3rem 0 2rem;
|
||||
text-align: center;
|
||||
border-bottom: 1px solid var(--border);
|
||||
margin-bottom: 3rem;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
font-size: 1.4rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
header h1 a {
|
||||
color: var(--text);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
nav {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
nav a {
|
||||
color: var(--text-light);
|
||||
text-decoration: none;
|
||||
margin: 0 0.8rem;
|
||||
font-size: 0.9rem;
|
||||
font-family: -apple-system, "Noto Sans SC", sans-serif;
|
||||
}
|
||||
|
||||
nav a:hover {
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
/* ===== 文章列表 ===== */
|
||||
.post-item {
|
||||
margin-bottom: 2.5rem;
|
||||
}
|
||||
|
||||
.post-item h2 {
|
||||
font-size: 1.2rem;
|
||||
font-weight: 600;
|
||||
margin-bottom: 0.3rem;
|
||||
}
|
||||
|
||||
.post-item h2 a {
|
||||
color: var(--text);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.post-item h2 a:hover {
|
||||
text-decoration: underline;
|
||||
text-decoration-thickness: 1px;
|
||||
text-underline-offset: 3px;
|
||||
}
|
||||
|
||||
.post-date {
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-muted);
|
||||
font-family: -apple-system, "Noto Sans SC", sans-serif;
|
||||
}
|
||||
|
||||
.post-summary {
|
||||
margin-top: 0.5rem;
|
||||
color: var(--text-light);
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
/* ===== 文章详情 ===== */
|
||||
article h1 {
|
||||
font-size: 1.6rem;
|
||||
font-weight: 700;
|
||||
line-height: 1.4;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.article-meta {
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-muted);
|
||||
margin-bottom: 2.5rem;
|
||||
font-family: -apple-system, "Noto Sans SC", sans-serif;
|
||||
}
|
||||
|
||||
.article-meta span {
|
||||
margin-right: 1rem;
|
||||
}
|
||||
|
||||
/* 正文排版 */
|
||||
.post-body {
|
||||
font-size: 17px;
|
||||
line-height: 1.9;
|
||||
}
|
||||
|
||||
.post-body h2 {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 600;
|
||||
margin: 2.2em 0 0.8em;
|
||||
}
|
||||
|
||||
.post-body h3 {
|
||||
font-size: 1.1rem;
|
||||
font-weight: 600;
|
||||
margin: 1.8em 0 0.6em;
|
||||
}
|
||||
|
||||
.post-body p {
|
||||
margin-bottom: 1.3em;
|
||||
}
|
||||
|
||||
.post-body a {
|
||||
color: var(--text);
|
||||
text-decoration: underline;
|
||||
text-decoration-color: var(--text-muted);
|
||||
text-underline-offset: 3px;
|
||||
}
|
||||
|
||||
.post-body a:hover {
|
||||
text-decoration-color: var(--text);
|
||||
}
|
||||
|
||||
.post-body img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
margin: 1.5em 0;
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
|
||||
.post-body blockquote {
|
||||
border-left: 3px solid var(--text-muted);
|
||||
padding: 0.5em 0 0.5em 1.2em;
|
||||
margin: 1.5em 0;
|
||||
color: var(--text-light);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.post-body ul, .post-body ol {
|
||||
margin-bottom: 1.3em;
|
||||
padding-left: 1.5em;
|
||||
}
|
||||
|
||||
.post-body li {
|
||||
margin-bottom: 0.4em;
|
||||
}
|
||||
|
||||
.post-body pre {
|
||||
background: var(--code-bg);
|
||||
padding: 1.2em;
|
||||
border-radius: var(--radius);
|
||||
overflow-x: auto;
|
||||
margin: 1.5em 0;
|
||||
font-size: 14px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.post-body code {
|
||||
font-family: "JetBrains Mono", "Fira Code", "Consolas", monospace;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.post-body p code, .post-body li code {
|
||||
background: var(--code-bg);
|
||||
padding: 0.15em 0.4em;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
/* ===== 分类/标签 ===== */
|
||||
.tags, .categories {
|
||||
margin-top: 3rem;
|
||||
padding-top: 1.5rem;
|
||||
border-top: 1px solid var(--border);
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-light);
|
||||
font-family: -apple-system, "Noto Sans SC", sans-serif;
|
||||
}
|
||||
|
||||
.tags a, .categories a {
|
||||
color: var(--text-light);
|
||||
text-decoration: none;
|
||||
margin-right: 0.8rem;
|
||||
}
|
||||
|
||||
.tags a:hover, .categories a:hover {
|
||||
color: var(--text);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* ===== 页脚 ===== */
|
||||
footer {
|
||||
margin-top: 5rem;
|
||||
padding: 2rem 0;
|
||||
text-align: center;
|
||||
font-size: 0.8rem;
|
||||
color: var(--text-muted);
|
||||
border-top: 1px solid var(--border);
|
||||
font-family: -apple-system, "Noto Sans SC", sans-serif;
|
||||
}
|
||||
|
||||
/* ===== 响应式 ===== */
|
||||
@media (max-width: 768px) {
|
||||
body { font-size: 16px; }
|
||||
header { padding: 2rem 0 1.5rem; margin-bottom: 2rem; }
|
||||
.post-body { font-size: 16px; }
|
||||
article h1 { font-size: 1.35rem; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<header>
|
||||
<h1><a href="/">郭安的小站</a></h1>
|
||||
<nav>
|
||||
<a href="/">首页</a>
|
||||
<a href="/archive/">归档</a>
|
||||
<a href="/about/">关于</a>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<p>© 2024 郭安的小站 · 用 Django 构建</p>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,33 @@
|
||||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}{{ 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>
|
||||
|
||||
<div class="post-body">
|
||||
{{ post.content|safe }}
|
||||
</div>
|
||||
|
||||
{% if post.tags.all %}
|
||||
<div class="tags">
|
||||
🏷
|
||||
{% for tag in post.tags.all %}
|
||||
<a href="/tag/{{ tag.slug }}/">{{ tag.name }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<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 %}
|
||||
@@ -0,0 +1,23 @@
|
||||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}郭安的小站{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% for post in posts %}
|
||||
<div class="post-item">
|
||||
<h2><a href="{{ post.get_absolute_url }}">{{ post.title }}</a></h2>
|
||||
<div class="post-date">{{ post.published_at|date:"Y年m月d日" }}</div>
|
||||
{% if post.excerpt %}
|
||||
<div class="post-summary">{{ post.excerpt }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% empty %}
|
||||
<div class="post-item" style="text-align: center; padding: 4rem 0; color: var(--text-muted);">
|
||||
<p style="margin-bottom: 0.5rem;">还没有文章</p>
|
||||
<p style="font-size: 0.9rem;">
|
||||
<a href="/admin/" style="color: var(--text-light); text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px;">去管理后台写一篇</a>
|
||||
</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user