AI 生成: 一个简洁优雅的个人博客网站,包含首页文章列表、文章详情页和关于页面。使用 Python Flask 构建,支持 Markdown 文章渲染。
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}页面未找到 - 我的博客{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section class="not-found">
|
||||
<h1>404</h1>
|
||||
<p>抱歉,你访问的页面不存在。</p>
|
||||
<a href="{{ url_for('index') }}" class="back-link">← 返回首页</a>
|
||||
</section>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,19 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}关于 - 我的博客{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section class="about">
|
||||
<h1>关于我</h1>
|
||||
<p>你好,欢迎来到我的个人博客!</p>
|
||||
<p>这里记录我在编程、生活、阅读中的思考与成长。我相信写作是最好的思考方式,也希望这些文字能对你有所启发。</p>
|
||||
|
||||
<h2>联系方式</h2>
|
||||
<ul class="contact-list">
|
||||
<li>邮箱:hello@example.com</li>
|
||||
<li>GitHub:<a href="https://github.com/" target="_blank" rel="noopener">github.com</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>关于本站</h2>
|
||||
<p>本站使用 Python Flask 构建,文章以 Markdown 格式编写,简洁、纯粹。</p>
|
||||
</section>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,30 @@
|
||||
<!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>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||
</head>
|
||||
<body>
|
||||
<header class="site-header">
|
||||
<div class="container header-inner">
|
||||
<a href="{{ url_for('index') }}" class="site-title">我的博客</a>
|
||||
<nav class="site-nav">
|
||||
<a href="{{ url_for('index') }}">首页</a>
|
||||
<a href="{{ url_for('about') }}">关于</a>
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="container">
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
|
||||
<footer class="site-footer">
|
||||
<div class="container">
|
||||
<p>© 2024 我的博客 · 用心记录每一刻</p>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,30 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}首页 - 我的博客{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section class="hero">
|
||||
<h1>欢迎来到我的博客</h1>
|
||||
<p class="subtitle">记录思考,分享成长</p>
|
||||
</section>
|
||||
|
||||
<section class="post-list">
|
||||
{% if posts %}
|
||||
{% for post in posts %}
|
||||
<article class="post-item">
|
||||
<h2 class="post-title">
|
||||
<a href="{{ url_for('post_detail', slug=post.slug) }}">{{ post.title }}</a>
|
||||
</h2>
|
||||
<div class="post-meta">
|
||||
<time>{{ post.date }}</time>
|
||||
</div>
|
||||
{% if post.summary %}
|
||||
<p class="post-summary">{{ post.summary }}</p>
|
||||
{% endif %}
|
||||
<a class="read-more" href="{{ url_for('post_detail', slug=post.slug) }}">阅读全文 →</a>
|
||||
</article>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<p class="empty-tip">还没有文章,去 <code>posts/</code> 目录添加吧。</p>
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,21 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}{{ post.title }} - 我的博客{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<article class="post-detail">
|
||||
<header class="post-header">
|
||||
<h1>{{ post.title }}</h1>
|
||||
<div class="post-meta">
|
||||
<time>{{ post.date }}</time>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="post-content">
|
||||
{{ content|safe }}
|
||||
</div>
|
||||
|
||||
<div class="post-footer">
|
||||
<a href="{{ url_for('index') }}" class="back-link">← 返回首页</a>
|
||||
</div>
|
||||
</article>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user