You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DjangoBlog/templates/base.html

551 lines
16 KiB

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
{% if category_info.name == '非遗传承' %}
金陵非遗 - 南京非物质文化遗产传承与创新
{% else %}
{{ category_info.name }} - 金陵非遗
{% endif %}
</title>
<style>
/* 所有CSS样式保持不变 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--primary-color: #8b4513;
--secondary-color: #d2691e;
--accent-color: #cd853f;
--text-dark: #2c1810;
--text-light: #5d4037;
--bg-light: #faf3e8;
--bg-white: #fffaf0;
--border-color: #e8d5c4;
}
body {
font-family: "Noto Serif SC", "Source Han Serif SC", "Microsoft YaHei", serif;
line-height: 1.7;
color: var(--text-dark);
background: linear-gradient(135deg, #faf3e8 0%, #fffaf0 100%);
min-height: 100vh;
}
/* 头部样式 - 中国风设计 */
.header {
background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
padding: 0;
box-shadow: 0 4px 20px rgba(139, 69, 19, 0.3);
position: relative;
overflow: hidden;
}
.header::before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
height: 4px;
background: linear-gradient(90deg, #ffd700, #ff6b6b, #4ecdc4, #ffd700);
animation: shimmer 3s infinite;
}
@keyframes shimmer {
0% { background-position: -200% 0; }
100% { background-position: 200% 0; }
}
.nav-container {
max-width: 1400px;
margin: 0 auto;
padding: 0 30px;
}
.site-brand {
text-align: center;
padding: 20px 0;
border-bottom: 1px solid rgba(255,255,255,0.2);
}
.site-title {
color: #fff;
font-size: 2.5em;
font-weight: 700;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
letter-spacing: 4px;
}
.site-subtitle {
color: #ffeb3b;
font-size: 1.1em;
margin-top: 8px;
font-style: italic;
}
.main-nav {
display: flex;
justify-content: center;
list-style: none;
padding: 15px 0;
}
.main-nav a {
display: block;
padding: 12px 25px;
color: #fff;
text-decoration: none;
font-size: 16px;
font-weight: 500;
transition: all 0.3s ease;
border-radius: 25px;
margin: 0 8px;
position: relative;
overflow: hidden;
}
.main-nav a::before {
content: "";
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
transition: left 0.5s;
}
.main-nav a:hover::before {
left: 100%;
}
.main-nav a:hover {
background: rgba(255,255,255,0.1);
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
/* 当前分类高亮样式 */
.current-category {
background: rgba(255, 255, 255, 0.25);
border: 2px solid rgba(255, 255, 255, 0.6);
font-weight: 600;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
/* 主要内容布局 */
.main-container {
max-width: 1400px;
margin: 40px auto;
padding: 0 30px;
display: grid;
grid-template-columns: 1fr 350px;
gap: 40px;
}
/* 文章内容区域 */
.content {
background: var(--bg-white);
border-radius: 15px;
box-shadow: 0 10px 30px rgba(139, 69, 19, 0.1);
overflow: hidden;
border: 1px solid var(--border-color);
}
.content-header {
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
color: white;
padding: 25px 30px;
text-align: center;
}
/* 分类标签样式 */
.category-label {
display: inline-block;
background: rgba(255, 255, 255, 0.2);
padding: 6px 16px;
border-radius: 20px;
font-size: 0.9em;
margin-bottom: 12px;
border: 1px solid rgba(255, 255, 255, 0.3);
font-weight: 500;
}
.content-header h1 {
font-size: 2em;
margin-bottom: 8px;
text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}
.content-intro {
font-size: 1.1em;
opacity: 0.95;
max-width: 800px;
margin: 0 auto;
line-height: 1.6;
padding: 0 20px;
}
.posts-list {
padding: 0;
}
/* 文章项样式 */
.post-item {
padding: 35px 30px;
border-bottom: 1px solid var(--border-color);
transition: all 0.3s ease;
position: relative;
}
.post-item::before {
content: "";
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 4px;
background: linear-gradient(to bottom, var(--primary-color), var(--accent-color));
opacity: 0;
transition: opacity 0.3s ease;
}
.post-item:hover {
background: linear-gradient(135deg, #fffaf0, #faf3e8);
transform: translateX(5px);
}
.post-item:hover::before {
opacity: 1;
}
.post-item:last-child {
border-bottom: none;
}
.post-title {
margin-bottom: 20px;
}
.post-title a {
color: var(--text-dark);
text-decoration: none;
font-size: 1.8em;
font-weight: 600;
line-height: 1.3;
transition: color 0.3s ease;
display: block;
}
.post-title a:hover {
color: var(--primary-color);
text-decoration: underline;
text-underline-offset: 3px;
}
.post-meta {
color: var(--text-light);
font-size: 14px;
margin-bottom: 20px;
display: flex;
align-items: center;
gap: 25px;
flex-wrap: wrap;
}
.post-meta span {
display: flex;
align-items: center;
gap: 6px;
}
.post-meta i {
font-style: normal;
opacity: 0.7;
}
.post-content {
color: var(--text-light);
font-size: 16px;
line-height: 1.8;
margin-bottom: 25px;
text-align: justify;
}
.read-more {
color: var(--primary-color);
text-decoration: none;
font-weight: 600;
font-size: 15px;
display: inline-flex;
align-items: center;
gap: 8px;
transition: all 0.3s ease;
padding: 8px 16px;
border: 2px solid var(--primary-color);
border-radius: 25px;
}
.read-more:hover {
background: var(--primary-color);
color: white;
transform: translateX(5px);
}
.post-footer {
color: var(--text-light);
font-size: 13px;
margin-top: 25px;
padding-top: 20px;
border-top: 1px dashed var(--border-color);
display: flex;
flex-wrap: wrap;
gap: 15px;
align-items: center;
}
.post-tags {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.tag {
background: linear-gradient(135deg, var(--accent-color), var(--secondary-color));
color: white;
padding: 4px 12px;
border-radius: 15px;
font-size: 12px;
font-weight: 500;
}
/* 侧边栏样式 */
.sidebar {
display: flex;
flex-direction: column;
gap: 25px;
}
.sidebar-widget {
background: var(--bg-white);
border-radius: 15px;
box-shadow: 0 8px 25px rgba(139, 69, 19, 0.1);
padding: 25px;
border: 1px solid var(--border-color);
}
.widget-title {
color: var(--primary-color);
font-size: 1.3em;
font-weight: 600;
margin-bottom: 20px;
padding-bottom: 12px;
border-bottom: 2px solid var(--accent-color);
display: flex;
align-items: center;
gap: 10px;
}
.widget-title::before {
content: "◆";
color: var(--secondary-color);
}
.views-list {
list-style: none;
}
.views-list li {
padding: 12px 0;
border-bottom: 1px solid var(--border-color);
color: var(--text-light);
font-size: 14px;
transition: all 0.3s ease;
display: flex;
justify-content: space-between;
align-items: center;
}
.views-list li:hover {
color: var(--primary-color);
transform: translateX(5px);
}
.views-list li:last-child {
border-bottom: none;
}
.view-count {
background: var(--accent-color);
color: white;
padding: 2px 8px;
border-radius: 10px;
font-size: 12px;
font-weight: 500;
}
/* 分类标签云 */
.tag-cloud {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.cloud-tag {
background: linear-gradient(135deg, #e8d5c4, #d7ccc8);
color: var(--text-light);
padding: 6px 12px;
border-radius: 15px;
font-size: 12px;
text-decoration: none;
transition: all 0.3s ease;
}
.cloud-tag:hover {
background: linear-gradient(135deg, var(--accent-color), var(--secondary-color));
color: white;
transform: translateY(-2px);
}
/* 响应式设计 */
@media (max-width: 1024px) {
.main-container {
grid-template-columns: 1fr;
gap: 25px;
}
.sidebar {
width: 100%;
}
}
@media (max-width: 768px) {
.nav-container {
padding: 0 15px;
}
.main-nav {
flex-wrap: wrap;
}
.main-nav a {
padding: 10px 15px;
font-size: 14px;
margin: 4px;
}
.site-title {
font-size: 2em;
}
.main-container {
padding: 0 15px;
margin: 20px auto;
}
.post-item {
padding: 25px 20px;
}
.post-title a {
font-size: 1.5em;
}
.content-header {
padding: 20px;
}
.content-header h1 {
font-size: 1.6em;
}
}
/* 页脚样式 */
.footer {
background: linear-gradient(135deg, var(--primary-color), var(--text-dark));
color: white;
text-align: center;
padding: 30px 20px;
margin-top: 60px;
}
.footer p {
opacity: 0.8;
font-size: 14px;
}
</style>
</head>
<body>
<header class="header">
<div class="nav-container">
<div class="site-brand">
<h1 class="site-title">金陵非遗</h1>
<div class="site-subtitle">南京非物质文化遗产传承与创新</div>
</div>
<nav class="main-nav">
<a href="{% url 'index' %}" class="{% if current_path == '/' %}current-category{% endif %}">首页</a>
<a href="{% url 'category' 1 %}" class="{% if current_category_id == 1 %}current-category{% endif %}">巧夺天工·工艺</a>
<a href="{% url 'category' 2 %}" class="{% if current_category_id == 2 %}current-category{% endif %}">梨园雅韵·表演</a>
<a href="{% url 'category' 3 %}" class="{% if current_category_id == 3 %}current-category{% endif %}">人间烟火·民俗</a>
<a href="{% url 'category' 4 %}" class="{% if current_category_id == 4 %}current-category{% endif %}">口传心授·文学</a>
<a href="{% url 'category' 5 %}" class="{% if current_category_id == 5 %}current-category{% endif %}">匠心传承·人物</a>
</nav>
</div>
</header>
<div class="main-container">
<main class="content">
<div class="content-header">
<!-- 动态标题和描述 - 使用从视图传递的数据 -->
{% if category_info.label %}
<div class="category-label">{{ category_info.label }}</div>
{% endif %}
<h1>{{ category_info.name }}</h1>
<div class="content-intro">{{ category_info.desc }}</div>
</div>
<div class="posts-list">
{% block content %}
{% endblock %}
</div>
</main>
<aside class="sidebar">
<div class="sidebar-widget">
<h3 class="widget-title">热门文章</h3>
<ul class="views-list">
<li>南京云锦织造技艺 <span class="view-count">156</span></li>
<li>金陵金箔制作工艺 <span class="view-count">128</span></li>
<li>秦淮灯会千年传承 <span class="view-count">95</span></li>
<li>南京白局艺术特色 <span class="view-count">87</span></li>
<li>金陵剪纸非遗大师 <span class="view-count">76</span></li>
</ul>
</div>
<div class="sidebar-widget">
<h3 class="widget-title">非遗分类</h3>
<div class="tag-cloud">
<a href="{% url 'category' 1 %}" class="cloud-tag">南京云锦</a>
<a href="{% url 'category' 1 %}" class="cloud-tag">金陵金箔</a>
<a href="{% url 'category' 3 %}" class="cloud-tag">秦淮灯会</a>
<a href="{% url 'category' 2 %}" class="cloud-tag">南京白局</a>
<a href="{% url 'category' 1 %}" class="cloud-tag">金陵剪纸</a>
<a href="{% url 'category' 1 %}" class="cloud-tag">十竹斋</a>
<a href="{% url 'category' 2 %}" class="cloud-tag">古琴艺术</a>
<a href="{% url 'category' 4 %}" class="cloud-tag">南京评话</a>
</div>
</div>
</aside>
</div>
<footer class="footer">
<p>© 2025 金陵非遗文化传承中心 | 传承非物质文化遗产,弘扬中华优秀传统文化</p>
</footer>
</body>
</html>