Compare commits

...

78 Commits

Author SHA1 Message Date
pa2g3nmk9 14ec29b972 上传文件至 'doc'
4 months ago
pa2g3nmk9 5b07e6797a 上传文件至 'doc'
4 months ago
pa2g3nmk9 0d3f35804e 更新 'src/DjangoBlog-master/.coveragerc'
4 months ago
pa2g3nmk9 378be4d193 更新 'src/DjangoBlog-master/templates/share_layout/nav.html'
4 months ago
pa2g3nmk9 95303e2ef6 更新 'src/DjangoBlog-master/templates/share_layout/footer.html'
4 months ago
pa2g3nmk9 9d65eb16cd 更新 'src/DjangoBlog-master/templates/share_layout/base.html'
4 months ago
pa2g3nmk9 ff4753eea7 更新 'src/DjangoBlog-master/templates/share_layout/adsense.html'
4 months ago
pa2g3nmk9 98729cb37f 更新 'src/DjangoBlog-master/templates/search/search.html'
4 months ago
pa2g3nmk9 07baf442fa 更新 'src/DjangoBlog-master/templates/owntracks/show_maps.html'
4 months ago
pa2g3nmk9 9498ec052c 更新 'src/DjangoBlog-master/templates/owntracks/show_log_dates.html'
4 months ago
pa2g3nmk9 3b7ac45324 更新 'src/DjangoBlog-master/templates/oauth/require_email.html'
4 months ago
pa2g3nmk9 362848b770 更新 'src/DjangoBlog-master/templates/oauth/bindsuccess.html'
4 months ago
pa2g3nmk9 1f226abd72 更新 'src/DjangoBlog-master/templates/comments/tags/post_comment.html'
4 months ago
pa2g3nmk9 5995d3b059 更新 'src/DjangoBlog-master/templates/comments/tags/comment_list.html'
4 months ago
pa2g3nmk9 acdcb55884 更新 'src/DjangoBlog-master/templates/comments/tags/comment_item_tree.html'
4 months ago
pa2g3nmk9 cd62b12a47 更新 'src/DjangoBlog-master/templates/comments/tags/comment_item.html'
4 months ago
pa2g3nmk9 daa98363a4 更新 'src/DjangoBlog-master/templates/blog/error_page.html'
4 months ago
pa2g3nmk9 2aa6f9e65f 更新 'src/DjangoBlog-master/templates/blog/article_index.html'
4 months ago
pa2g3nmk9 d2719cb0c1 更新 'src/DjangoBlog-master/templates/blog/article_archives.html'
4 months ago
pa2g3nmk9 0395e61f3d 更新 'src/DjangoBlog-master/templates/blog/tags/sidebar.html'
4 months ago
pa2g3nmk9 39fad5bb5b 更新 'src/DjangoBlog-master/templates/share_layout/nav_node.html'
4 months ago
pa2g3nmk9 34b31ec891 更新 'src/DjangoBlog-master/templates/share_layout/nav.html'
4 months ago
pa2g3nmk9 4911e51d08 更新 'src/DjangoBlog-master/templates/share_layout/footer.html'
4 months ago
pa2g3nmk9 4aa2db54e3 更新 'src/DjangoBlog-master/templates/share_layout/base_account.html'
4 months ago
pa2g3nmk9 f820d39ab1 更新 'src/DjangoBlog-master/templates/share_layout/base.html'
4 months ago
pa2g3nmk9 a8bd23395d 更新 'src/DjangoBlog-master/templates/share_layout/adsense.html'
4 months ago
pa2g3nmk9 d061ad191f 更新 'src/DjangoBlog-master/templates/search/search.html'
4 months ago
pa2g3nmk9 92cfbd8f80 更新 'src/DjangoBlog-master/templates/search/indexes/blog/article_text.txt'
4 months ago
pa2g3nmk9 49cc934f20 更新 'src/DjangoBlog-master/templates/owntracks/show_maps.html'
4 months ago
pa2g3nmk9 4748fd93b9 更新 'src/DjangoBlog-master/templates/owntracks/show_log_dates.html'
4 months ago
pa2g3nmk9 7f6fd461d0 更新 'src/DjangoBlog-master/templates/oauth/require_email.html'
4 months ago
pa2g3nmk9 abc64e1ee9 更新 'src/DjangoBlog-master/templates/oauth/oauth_applications.html'
4 months ago
pa2g3nmk9 dfb4fed99b 更新 'src/DjangoBlog-master/templates/oauth/bindsuccess.html'
4 months ago
pa2g3nmk9 ce3c9cab1d 更新 'src/DjangoBlog-master/templates/comments/tags/post_comment.html'
4 months ago
pa2g3nmk9 648ba70cfe 更新 'src/DjangoBlog-master/templates/comments/tags/comment_list.html'
4 months ago
pa2g3nmk9 39c20413a5 更新 'src/DjangoBlog-master/templates/comments/tags/comment_item_tree.html'
4 months ago
pa2g3nmk9 b6131f4c29 更新 'src/DjangoBlog-master/templates/comments/tags/comment_item.html'
4 months ago
pa2g3nmk9 8b9867c863 更新 'src/DjangoBlog-master/templates/blog/links_list.html'
4 months ago
pa2g3nmk9 206afc4e43 更新 'src/DjangoBlog-master/templates/blog/error_page.html'
4 months ago
pa2g3nmk9 5c7e28cf65 更新 'src/DjangoBlog-master/templates/blog/article_index.html'
4 months ago
pa2g3nmk9 d18b86d301 更新 'src/DjangoBlog-master/templates/blog/article_detail.html'
4 months ago
pa2g3nmk9 4ae995152c 更新 'src/DjangoBlog-master/templates/blog/article_archives.html'
4 months ago
pa2g3nmk9 c1b23274a7 更新 'src/DjangoBlog-master/requirements.txt'
4 months ago
pa2g3nmk9 6e0aeb481f 更新 'src/DjangoBlog-master/manage.py'
4 months ago
pa2g3nmk9 6b951458eb 更新 'src/DjangoBlog-master/README.md'
4 months ago
pa2g3nmk9 687e5a9e2f 更新 'src/DjangoBlog-master/LICENSE'
4 months ago
pa2g3nmk9 453970fc33 更新 'src/DjangoBlog-master/Dockerfile'
4 months ago
pa2g3nmk9 114b44d401 更新 'src/DjangoBlog-master/.gitignore'
4 months ago
pa2g3nmk9 514ca70c3e 更新 'src/DjangoBlog-master/.gitattributes'
4 months ago
pa2g3nmk9 c07d3742b4 更新 'src/DjangoBlog-master/.dockerignore'
4 months ago
pa2g3nmk9 f0fe0f441f 更新 'src/DjangoBlog-master/.coveragerc'
4 months ago
pa2g3nmk9 d998123261 更新 'src/DjangoBlog-master/templates/blog/tags/sidebar.html'
4 months ago
pa2g3nmk9 c316fae532 更新 'src/DjangoBlog-master/templates/blog/tags/breadcrumb.html'
4 months ago
pa2g3nmk9 2dbc0f9f11 更新 'src/DjangoBlog-master/templates/blog/tags/article_tag_list.html'
4 months ago
pa2g3nmk9 55cb098cd4 更新 'src/DjangoBlog-master/templates/blog/tags/article_pagination.html'
4 months ago
pa2g3nmk9 1de6350414 更新 'src/DjangoBlog-master/templates/blog/tags/article_meta_info.html'
4 months ago
pa2g3nmk9 494b1f1f59 更新 'src/DjangoBlog-master/templates/blog/tags/article_info.html'
4 months ago
pa2g3nmk9 15b588b86a 更新 'src/DjangoBlog-master/templates/account/result.html'
4 months ago
pa2g3nmk9 0bf8395528 更新 'src/DjangoBlog-master/templates/account/registration_form.html'
4 months ago
pa2g3nmk9 f1f4d6ca72 更新 'src/DjangoBlog-master/templates/account/login.html'
4 months ago
pa2g3nmk9 958615fd0b 更新 'src/DjangoBlog-master/templates/account/forget_password.html'
4 months ago
fz a029e57ccc docs: 添加开源软件泛读报告到doc目录
4 months ago
fz ad7cb481e6 docs: 将'电影评价'软件系统的数据模型设计文档移动到doc目录
4 months ago
fz 6875481d7e 添加电影评价系统数据模型设计文档
4 months ago
fz c15310b677 fix: resolve nested merge conflict in README.md
5 months ago
fz c1a0f16d1f merge: resolve README.md conflict, keep remote Chinese version
5 months ago
fz 2dc4112e09 添加电影评价软件界面设计说明书
5 months ago
zxc 2907454eb6 Update admin.py
5 months ago
fz 1000752d3d 解决README.md冲突并清理临时文件
5 months ago
zxc cfb4939c5a Update 0002_alter_owntracklog_options_and_more.py
5 months ago
zxc 82c7f26e8f Update 0001_initial.py
5 months ago
zxc 50b5eda147 Update 0001_initial.py
5 months ago
plhw57tbe c8630a7f95 Merge pull request '合并源代码' (#4) from smy_branch into develop
5 months ago
fz 11203b3ce1 添加电影评价软件界面设计说明书模板
5 months ago
fz 2513a76c28 添加电影评价软件界面设计说明书模板
5 months ago
fz f338bb2378 备份develop分支的修改
5 months ago
smy 192f27dd24 在master分支添加doc目录及README.md文档
5 months ago
smy 3fac0dcd23 删除master分支中的README.md文件
5 months ago

@ -0,0 +1,26 @@
# 项目开发报告
## 项目概述
本项目是一个软件工程方法论实践项目。
## 登录功能开发进度
### 已完成
- [x] 项目环境搭建
- [x] Git分支管理配置
- [x] 基础文档结构创建
### 进行中
- [ ] 用户登录功能实现
- [ ] 密码加密模块
- [ ] 会话管理功能
### 技术栈
- Python 3.x
- Git 版本控制
- Markdown 文档
## 下一步计划
1. 实现登录功能代码
2. 编写单元测试
3. 完成集成测试

Binary file not shown.

Binary file not shown.

@ -1,10 +1,9 @@
[run]
source = .
include = *.py
omit =
*migrations*
*tests*
*.html
*whoosh_cn_backend*
*settings.py*
*venv*
source = . # 分析当前目录下的代码
include = *.py # 包含所有 .py 文件
omit = # 排除以下文件/目录
*migrations* # 数据库迁移文件
*tests* # 测试文件
*.html # HTML 文件
*whoosh_cn_backend* # Whoosh 中文后端
*settings.py* # 设置文件
*venv* # 虚拟环境

@ -1,11 +1,20 @@
bin/data/
# virtualenv
venv/
collectedstatic/
djangoblog/whoosh_index/
uploads/
settings_production.py
*.md
docs/
logs/
static/
[run]
source = .
include = *.py
omit =
*migrations*
*tests*
*.html
*whoosh_cn_backend*
*settings.py*
*venv*
bin/data/ # 二进制数据目录
venv/ # 虚拟环境目录
collectedstatic/ # 收集的静态文件目录
djangoblog/whoosh_index/ # Whoosh搜索索引目录
uploads/ # 文件上传目录
settings_production.py # 生产环境配置文件
*.md # Markdown文档文件
docs/ # 文档目录
logs/ # 日志文件目录
static/ # 静态文件目录

@ -1,6 +1,6 @@
blog/static/* linguist-vendored
*.js linguist-vendored
*.css linguist-vendored
* text=auto
*.sh text eol=lf
*.conf text eol=lf
blog/static/* linguist-vendored # 静态文件标记为vendored
*.js linguist-vendored # JS文件标记为vendored
*.css linguist-vendored # CSS文件标记为vendored
* text=auto # 自动检测文本文件
*.sh text eol=lf # Shell脚本使用LF换行
*.conf text eol=lf # 配置文件使用LF换行

@ -1,80 +1,80 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
__pycache__/ # Python缓存文件
*.py[cod] # Python编译文件
*$py.class # Python类文件
# C extensions
*.so
*.so # C扩展文件
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
.Python # Python相关文件
env/ # 环境目录
build/ # 构建目录
develop-eggs/ # 开发egg包
dist/ # 分发目录
downloads/ # 下载目录
eggs/ # Egg包目录
.eggs/ # Egg包目录
lib/ # 库目录
lib64/ # 64位库目录
parts/ # 部件目录
sdist/ # 源码分发目录
var/ # 变量目录
*.egg-info/ # Egg信息目录
.installed.cfg # 安装配置
*.egg # Egg文件
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
*.manifest # 清单文件
*.spec # 规范文件
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
pip-log.txt # Pip日志
pip-delete-this-directory.txt # Pip删除目录标记
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
htmlcov/ # HTML覆盖率报告
.tox/ # Tox测试目录
.coverage # 覆盖率数据
.coverage.* # 覆盖率数据文件
.cache # 缓存目录
nosetests.xml # Nose测试报告
coverage.xml # 覆盖率XML报告
*,cover # 覆盖率文件
# Translations
*.pot
*.pot # 翻译模板文件
# Django stuff:
*.log
logs/
*.log # 日志文件
logs/ # 日志目录
# Sphinx documentation
docs/_build/
docs/_build/ # Sphinx构建目录
# PyBuilder
target/
target/ # 目标目录
# PyCharm
# http://www.jetbrains.com/pycharm/webhelp/project.html
.idea
.iml
static/
.idea # PyCharm IDE配置
.iml # IntelliJ模块文件
static/ # 静态文件目录
# virtualenv
venv/
venv/ # 虚拟环境目录
collectedstatic/
djangoblog/whoosh_index/
google93fd32dbd906620a.html
baidu_verify_FlHL7cUyC9.html
BingSiteAuth.xml
cb9339dbe2ff86a5aa169d28dba5f615.txt
werobot_session.*
django.jpg
uploads/
settings_production.py
werobot_session.db
bin/datas/
collectedstatic/ # 收集的静态文件目录
djangoblog/whoosh_index/ # Whoosh搜索索引目录
google93fd32dbd906620a.html # Google验证文件
baidu_verify_FlHL7cUyC9.html # 百度验证文件
BingSiteAuth.xml # Bing站点认证文件
cb9339dbe2ff86a5aa169d28dba5f615.txt # 验证文本文件
werobot_session.* # WeRobot会话文件
django.jpg # Django图片文件
uploads/ # 文件上传目录
settings_production.py # 生产环境配置文件
werobot_session.db # WeRobot会话数据库
bin/datas/ # 二进制数据目录

@ -1,15 +1,15 @@
FROM python:3.11
ENV PYTHONUNBUFFERED 1
WORKDIR /code/djangoblog/
RUN apt-get update && \
apt-get install default-libmysqlclient-dev gettext -y && \
rm -rf /var/lib/apt/lists/*
ADD requirements.txt requirements.txt
RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt && \
pip install --no-cache-dir gunicorn[gevent] && \
pip cache purge
ENV PYTHONUNBUFFERED 1 # 设置Python无缓冲模式
WORKDIR /code/djangoblog/ # 设置工作目录
RUN apt-get update && \\
apt-get install default-libmysqlclient-dev gettext -y && \\ # 安装MySQL客户端和gettext
rm -rf /var/lib/apt/lists/* # 清理APT缓存
ADD requirements.txt requirements.txt # 添加依赖文件
RUN pip install --upgrade pip && \\
pip install --no-cache-dir -r requirements.txt && \\ # 安装Python依赖
pip install --no-cache-dir gunicorn[gevent] && \\ # 安装Gunicorn服务器
pip cache purge # 清理pip缓存
ADD . .
RUN chmod +x /code/djangoblog/deploy/entrypoint.sh
ENTRYPOINT ["/code/djangoblog/deploy/entrypoint.sh"]
ADD . . # 添加项目代码
RUN chmod +x /code/djangoblog/deploy/entrypoint.sh # 给入口脚本添加执行权限
ENTRYPOINT ["/code/djangoblog/deploy/entrypoint.sh"] # 设置入口点脚本

@ -1,20 +1,22 @@
The MIT License (MIT)
```
The MIT License (MIT) # MIT许可证
Copyright (c) 2025 车亮亮
Copyright (c) 2025 车亮亮 # 版权所有2025 车亮亮
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
subject to the following conditions: # 允许任何人免费使用、复制、修改、合并、发布、分发、再许可和/或销售软件的副本
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
copies or substantial portions of the Software. # 上述版权声明和许可声明必须包含在所有副本或实质性部分中
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # 软件按原样提供,不承担任何明示或暗示的担保责任
```

@ -1,61 +1,60 @@
# DjangoBlog
# DjangoBlog # Django博客项目
<p align="center">
<a href="https://github.com/liangliangyy/DjangoBlog/actions/workflows/django.yml"><img src="https://github.com/liangliangyy/DjangoBlog/actions/workflows/django.yml/badge.svg" alt="Django CI"></a>
<a href="https://github.com/liangliangyy/DjangoBlog/actions/workflows/codeql-analysis.yml"><img src="https://github.com/liangliangyy/DjangoBlog/actions/workflows/codeql-analysis.yml/badge.svg" alt="CodeQL"></a>
<a href="https://codecov.io/gh/liangliangyy/DjangoBlog"><img src="https://codecov.io/gh/liangliangyy/DjangoBlog/branch/master/graph/badge.svg" alt="codecov"></a>
<a href="https://github.com/liangliangyy/DjangoBlog/blob/master/LICENSE"><img src="https://img.shields.io/github/license/liangliangyy/djangoblog.svg" alt="license"></a>
<a href="https://github.com/liangliangyy/DjangoBlog/actions/workflows/django.yml"><img src="https://github.com/liangliangyy/DjangoBlog/actions/workflows/django.yml/badge.svg" alt="Django CI"></a> # Django持续集成状态
<a href="https://github.com/liangliangyy/DjangoBlog/actions/workflows/codeql-analysis.yml"><img src="https://github.com/liangliangyy/DjangoBlog/actions/workflows/codeql-analysis.yml/badge.svg" alt="CodeQL"></a> # 代码质量分析状态
<a href="https://codecov.io/gh/liangliangyy/DjangoBlog"><img src="https://codecov.io/gh/liangliangyy/DjangoBlog/branch/master/graph/badge.svg" alt="codecov"></a> # 代码覆盖率状态
<a href="https://github.com/liangliangyy/DjangoBlog/blob/master/LICENSE"><img src="https://img.shields.io/github/license/liangliangyy/djangoblog.svg" alt="license"></a> # 开源许可证状态
</p>
<p align="center">
<b>一款功能强大、设计优雅的现代化博客系统</b>
<b>一款功能强大、设计优雅的现代化博客系统</b> # 项目描述
<br>
<a href="/docs/README-en.md">English</a> <b>简体中文</b>
<a href="/docs/README-en.md">English</a> ? <b>简体中文</b> # 语言切换
</p>
---
DjangoBlog 是一款基于 Python 3.10 和 Django 4.0 构建的高性能博客平台。它不仅提供了传统博客的所有核心功能还通过一个灵活的插件系统让您可以轻松扩展和定制您的网站。无论您是个人博主、技术爱好者还是内容创作者DjangoBlog 都旨在为您提供一个稳定、高效且易于维护的写作和发布环境。
DjangoBlog 是一款基于 Python 3.10 和 Django 4.0 构建的高性能博客平台。它不仅提供了传统博客的所有核心功能还通过一个灵活的插件系统让您可以轻松扩展和定制您的网站。无论您是个人博主、技术爱好者还是内容创作者DjangoBlog 都旨在为您提供一个稳定、高效且易于维护的写作和发布环境。 # 项目介绍
## ✨ 特性亮点
## ? 特性亮点 # 主要特性
- **强大的内容管理**: 支持文章、独立页面、分类和标签的完整管理。内置强大的 Markdown 编辑器,支持代码语法高亮。
- **全文搜索**: 集成搜索引擎,提供快速、精准的文章内容搜索。
- **互动评论系统**: 支持回复、邮件提醒等功能,评论内容同样支持 Markdown。
- **灵活的侧边栏**: 可自定义展示最新文章、最多阅读、标签云等模块。
- **社交化登录**: 内置 OAuth 支持,已集成 Google, GitHub, Facebook, 微博, QQ 等主流平台。
- **高性能缓存**: 原生支持 Redis 缓存,并提供自动刷新机制,确保网站高速响应。
- **SEO 友好**: 具备基础 SEO 功能,新内容发布后可自动通知 Google 和百度。
- **便捷的插件系统**: 通过创建独立的插件来扩展博客功能代码解耦易于维护。我们已经通过插件实现了文章浏览计数、SEO 优化等功能!
- **集成图床**: 内置简单的图床功能,方便图片上传和管理。
- **自动化前端**: 集成 `django-compressor`,自动压缩和优化 CSS 及 JavaScript 文件。
- **健壮的运维**: 内置网站异常邮件提醒和微信公众号管理功能。
- **强大的内容管理**: 支持文章、独立页面、分类和标签的完整管理。内置强大的 Markdown 编辑器,支持代码语法高亮。 # 内容管理功能
- **全文搜索**: 集成搜索引擎,提供快速、精准的文章内容搜索。 # 搜索功能
- **互动评论系统**: 支持回复、邮件提醒等功能,评论内容同样支持 Markdown。 # 评论系统
- **灵活的侧边栏**: 可自定义展示最新文章、最多阅读、标签云等模块。 # 侧边栏定制
- **社交化登录**: 内置 OAuth 支持,已集成 Google, GitHub, Facebook, 微博, QQ 等主流平台。 # 第三方登录
- **高性能缓存**: 原生支持 Redis 缓存,并提供自动刷新机制,确保网站高速响应。 # 缓存机制
- **SEO 友好**: 具备基础 SEO 功能,新内容发布后可自动通知 Google 和百度。 # SEO优化
- **便捷的插件系统**: 通过创建独立的插件来扩展博客功能代码解耦易于维护。我们已经通过插件实现了文章浏览计数、SEO 优化等功能! # 插件系统
- **集成图床**: 内置简单的图床功能,方便图片上传和管理。 # 图床功能
- **自动化前端**: 集成 `django-compressor`,自动压缩和优化 CSS 及 JavaScript 文件。 # 前端优化
- **健壮的运维**: 内置网站异常邮件提醒和微信公众号管理功能。 # 运维功能
## 🛠️ 技术栈
## ??? 技术栈 # 技术架构
- **后端**: Python 3.10, Django 4.0
- **数据库**: MySQL, SQLite (可配置)
- **缓存**: Redis
- **前端**: HTML5, CSS3, JavaScript
- **搜索**: Whoosh, Elasticsearch (可配置)
- **编辑器**: Markdown (mdeditor)
- **后端**: Python 3.10, Django 4.0 # 后端技术
- **数据库**: MySQL, SQLite (可配置) # 数据库支持
- **缓存**: Redis # 缓存技术
- **前端**: HTML5, CSS3, JavaScript # 前端技术
- **搜索**: Whoosh, Elasticsearch (可配置) # 搜索引擎
- **编辑器**: Markdown (mdeditor) # 编辑器
## 🚀 快速开始
## ?? 快速开始 # 快速入门指南
### 1. 环境准备
### 1. 环境准备 # 环境要求
确保您的系统中已安装 Python 3.10+ 和 MySQL/MariaDB。
确保您的系统中已安装 Python 3.10+ 和 MySQL/MariaDB。 # 系统要求
### 2. 克隆与安装
### 2. 克隆与安装 # 安装步骤
```bash
# 克隆项目到本地
# 克隆项目到本地 # 克隆代码
git clone https://github.com/liangliangyy/DjangoBlog.git
cd DjangoBlog
# 安装依赖
# 安装依赖 # 安装Python包
pip install -r requirements.txt
```
### 3. 项目配置

@ -1,22 +1,23 @@
#!/usr/bin/env python
import os
import sys
#!/usr/bin/env python # 使用Python解释器执行
import os # 导入操作系统接口模块
import sys # 导入系统相关参数和函数
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djangoblog.settings")
if __name__ == "__main__": # 主程序入口
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djangoblog.settings") # 设置Django配置模块环境变量
try:
from django.core.management import execute_from_command_line
except ImportError:
from django.core.management import execute_from_command_line # 导入Django命令行执行函数
except ImportError: # 处理导入错误
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
# 上面的导入可能因其他原因失败。确保问题确实是Django缺失以避免掩盖Python 2上的其他异常。
try:
import django
except ImportError:
raise ImportError(
import django # 尝试导入Django
except ImportError: # 如果Django导入失败
raise ImportError( # 抛出导入错误
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
"forget to activate a virtual environment?" # 提示Django未安装或虚拟环境未激活
)
raise
execute_from_command_line(sys.argv)
raise # 重新抛出其他异常
execute_from_command_line(sys.argv) # 执行Django命令行命令

@ -1,7 +1,13 @@
# 导入Django的admin模块用于管理后台配置
from django.contrib import admin
# 注册模型的地方(当前尚未注册任何模型)
# Register your models here.
# 定义OwnTrackLogs模型的Admin管理类
# 继承自ModelAdmin这是Django admin的基础管理类
class OwnTrackLogsAdmin(admin.ModelAdmin):
# pass表示暂时不添加任何自定义配置
# 此时会使用ModelAdmin的默认配置来展示和管理模型数据
pass

@ -1,31 +1,40 @@
# Generated by Django 4.1.7 on 2023-03-02 07:14
# 由Django 4.1.7在2023年3月2日07:14生成
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
"""数据库迁移类,用于定义数据库结构的变更"""
# 标识这是初始迁移(第一次创建模型)
initial = True
# 依赖的其他迁移文件,初始迁移没有依赖
dependencies = [
]
# 定义要执行的数据库操作列表
operations = [
# 创建一个新的数据模型(数据库表)
migrations.CreateModel(
name='OwnTrackLog',
fields=[
name='OwnTrackLog', # 模型名称,对应数据库中的表名
fields=[ # 模型包含的字段定义
# 自增主键字段BigAutoField会自动生成大整数类型的唯一ID
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
# 用户标识符字段字符串类型最大长度100
('tid', models.CharField(max_length=100, verbose_name='用户')),
# 纬度字段,浮点型
('lat', models.FloatField(verbose_name='纬度')),
# 经度字段,浮点型
('lon', models.FloatField(verbose_name='经度')),
# 创建时间字段,默认值为当前时间
('created_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='创建时间')),
],
options={
'verbose_name': 'OwnTrackLogs',
'verbose_name_plural': 'OwnTrackLogs',
'ordering': ['created_time'],
'get_latest_by': 'created_time',
options={ # 模型的额外配置选项
'verbose_name': 'OwnTrackLogs', # 模型的单数显示名称
'verbose_name_plural': 'OwnTrackLogs', # 模型的复数显示名称
'ordering': ['created_time'], # 默认排序方式,按创建时间升序
'get_latest_by': 'created_time', # 指定获取最新记录时使用的字段
},
),
]

@ -1,22 +1,36 @@
# Generated by Django 4.2.5 on 2023-09-06 13:19
# 由Django 4.2.5版本在2023年9月6日13:19自动生成
from django.db import migrations
class Migration(migrations.Migration):
"""
数据库迁移类用于修改现有数据模型的结构和配置
这是一个增量迁移基于之前的迁移进行修改
"""
# 依赖关系:表示此迁移依赖于'owntracks'应用中的0001_initial迁移
# 执行此迁移前必须先执行完依赖的迁移
dependencies = [
('owntracks', '0001_initial'),
]
# 定义要执行的数据库操作列表
operations = [
# 修改模型的配置选项
migrations.AlterModelOptions(
name='owntracklog',
options={'get_latest_by': 'creation_time', 'ordering': ['creation_time'], 'verbose_name': 'OwnTrackLogs', 'verbose_name_plural': 'OwnTrackLogs'},
name='owntracklog', # 要修改的模型名称
# 新的模型配置选项
options={
'get_latest_by': 'creation_time', # 更新获取最新记录的字段为creation_time
'ordering': ['creation_time'], # 更新默认排序字段为creation_time
'verbose_name': 'OwnTrackLogs', # 模型的单数显示名称(未变)
'verbose_name_plural': 'OwnTrackLogs' # 模型的复数显示名称(未变)
},
),
# 重命名字段
migrations.RenameField(
model_name='owntracklog',
old_name='created_time',
new_name='creation_time',
model_name='owntracklog', # 要操作的模型名称
old_name='created_time', # 原字段名
new_name='creation_time', # 新字段名
),
]

@ -1,30 +1,44 @@
{% extends 'share_layout/base_account.html' %}
{% load i18n %}
{% load static %}
{% block content %}
<div class="container">
{# 页面标题 #}
<h2 class="form-signin-heading text-center">{% trans 'forget the password' %}</h2>
{# 主要内容卡片 #}
<div class="card card-signin">
{# 用户头像 #}
<img class="img-circle profile-img" src="{% static 'blog/img/avatar.png' %}" alt="">
{# 忘记密码表单 #}
<form class="form-signin" action="{% url 'account:forget_password' %}" method="post">
{% csrf_token %}
{% csrf_token %} {# CSRF令牌用于防止跨站请求伪造 #}
{# 显示表单非字段错误(如表单级别的验证错误) #}
{{ form.non_field_errors }}
{# 循环遍历表单的所有字段 #}
{% for field in form %}
{{ field }}
{{ field.errors }}
{{ field }} {# 渲染字段输入框 #}
{{ field.errors }} {# 显示字段特定错误 #}
{% endfor %}
<input type="button" class="button" id="btn" value="{% trans 'get verification code' %}">
<button class="btn btn-lg btn-primary btn-block" type="submit">{% trans 'submit' %}</button>
{# 获取验证码按钮 #}
<input type="button" class="button" id="btn" value="{% trans 'get verification code' %}">
{# 提交按钮 #}
<button class="btn btn-lg btn-primary btn-block" type="submit">{% trans 'submit' %}</button>
</form>
</div>
{# 页面底部链接 #}
<p class="text-center">
<a href="/">Home Page</a>
<a href="/">Home Page</a> {# 首页链接 #}
|
<a href="{% url "account:login" %}">login page</a>
<a href="{% url "account:login" %}">login page</a> {# 登录页面链接 #}
</p>
</div> <!-- /container -->
{% endblock %}
{% endblock %}

@ -4,39 +4,58 @@
{% block content %}
<div class="container">
{# 页面标题:用户登录 #}
<h2 class="form-signin-heading text-center">Sign in with your Account</h2>
{# 登录卡片容器 #}
<div class="card card-signin">
{# 用户头像显示 #}
<img class="img-circle profile-img" src="{% static 'blog/img/avatar.png' %}" alt="">
{# 登录表单 #}
<form class="form-signin" action="{% url 'account:login' %}" method="post">
{% csrf_token %}
{% csrf_token %} {# CSRF保护令牌 #}
{# 显示表单级别的错误信息 #}
{{ form.non_field_errors }}
{# 循环渲染表单的所有字段 #}
{% for field in form %}
{{ field }}
{{ field.errors }}
{{ field }} {# 表单字段输入框 #}
{{ field.errors }} {# 字段特定错误信息 #}
{% endfor %}
{# 隐藏字段登录成功后重定向的URL #}
<input type="hidden" name="next" value="{{ redirect_to }}">
{# 登录提交按钮 #}
<button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
{# 记住我选项 #}
<div class="checkbox">
{% comment %}<a class="pull-right">Need help?</a>{% endcomment %}
{% comment %}<a class="pull-right">Need help?</a>{% endcomment %} {# 被注释的帮助链接 #}
<label>
<input type="checkbox" value="remember-me" name="remember"> Stay signed in
</label>
</div>
{# 第三方OAuth登录应用 #}
{% load oauth_tags %}
{% load_oauth_applications request%}
{% load_oauth_applications request%} {# 加载OAuth登录选项 #}
</form>
</div>
{# 页面底部导航链接 #}
<p class="text-center">
{# 注册账号链接 #}
<a href="{% url "account:register" %}">
{% trans 'Create Account' %}
</a>
|
{# 首页链接 #}
<a href="/">Home Page</a>
|
{# 忘记密码链接 #}
<a href="{% url "account:forget_password" %}">
{% trans 'Forget Password' %}
</a>

@ -3,26 +3,36 @@
{% block content %}
<div class="container">
{# 页面标题:用户注册 #}
<h2 class="form-signin-heading text-center">Create Your Account</h2>
{# 注册卡片容器 #}
<div class="card card-signin">
{# 默认用户头像 #}
<img class="img-circle profile-img" src="{% static 'blog/img/avatar.png' %}" alt="">
{# 用户注册表单 #}
<form class="form-signin" action="{% url 'account:register' %}" method="post">
{% csrf_token %}
{% csrf_token %} {# CSRF保护令牌防止跨站请求伪造 #}
{# 显示表单级别的错误信息(非特定字段的错误) #}
{{ form.non_field_errors }}
{# 循环遍历并渲染表单的所有字段 #}
{% for field in form %}
{{ field }}
{{ field.errors }}
{{ field }} {# 渲染表单字段输入框 #}
{{ field.errors }} {# 显示字段特定的验证错误信息 #}
{% endfor %}
{# 注册提交按钮 #}
<button class="btn btn-lg btn-primary btn-block" type="submit">Create Your Account</button>
</form>
</div>
{# 页面底部链接:已有账号登录 #}
<p class="text-center">
<a href="{% url "account:login" %}">Sign In</a>
<a href="{% url "account:login" %}">Sign In</a> {# 跳转到登录页面 #}
</p>
</div> <!-- /container -->

@ -1,23 +1,23 @@
{% extends 'share_layout/base.html' %}
{% load i18n %}
{% block header %}
<title> {{ title }}</title>
<title> {{ title }}</title> {# 设置页面标题 #}
{% endblock %}
{% block content %}
<div id="primary" class="site-content">
<div id="content" role="main">
<header class="archive-header">
<h2 class="archive-title"> {{ content }}</h2>
<h2 class="archive-title"> {{ content }}</h2> {# 显示主要内容 #}
</header><!-- .archive-header -->
<br/>
<header class="archive-header" style="text-align: center">
{# 登录页面链接 #}
<a href="{% url "account:login" %}">
{% trans 'login' %}
</a>
|
{# 返回首页链接 #}
<a href="/">
{% trans 'back to the homepage' %}
</a>

@ -1,42 +1,42 @@
{% extends 'share_layout/base.html' %}
{% load blog_tags %}
{% load cache %}
{% load i18n %}
{% block header %}
<title>{% trans 'article archive' %} | {{ SITE_DESCRIPTION }}</title>
<meta name="description" content="{{ SITE_SEO_DESCRIPTION }}"/>
<meta name="keywords" content="{{ SITE_KEYWORDS }}"/>
<meta property="og:type" content="blog"/>
<meta property="og:title" content="{{ SITE_NAME }}"/>
<meta property="og:description" content="{{ SITE_DESCRIPTION }}"/>
<meta property="og:url" content="{{ SITE_BASE_URL }}"/>
<meta property="og:site_name" content="{{ SITE_NAME }}"/>
{% extends 'share_layout/base.html' %} {# 继承基础布局模板 #}
{% load blog_tags %} {# 加载博客自定义标签 #}
{% load cache %} {# 加载缓存标签 #}
{% load i18n %} {# 加载国际化标签 #}
{% block header %} {# 头部内容块 #}
<title>{% trans 'article archive' %} | {{ SITE_DESCRIPTION }}</title> {# 页面标题 #}
<meta name="description" content="{{ SITE_SEO_DESCRIPTION }}"/> {# 页面描述 #}
<meta name="keywords" content="{{ SITE_KEYWORDS }}"/> {# 页面关键词 #}
<meta property="og:type" content="blog"/> {# OpenGraph类型 #}
<meta property="og:title" content="{{ SITE_NAME }}"/> {# OpenGraph标题 #}
<meta property="og:description" content="{{ SITE_DESCRIPTION }}"/> {# OpenGraph描述 #}
<meta property="og:url" content="{{ SITE_BASE_URL }}"/> {# OpenGraph网址 #}
<meta property="og:site_name" content="{{ SITE_NAME }}"/> {# OpenGraph站点名称 #}
{% endblock %}
{% block content %}
<div id="primary" class="site-content">
<div id="content" role="main">
{% block content %} {# 主要内容块 #}
<div id="primary" class="site-content"> {# 主要内容区域 #}
<div id="content" role="main"> {# 内容区域 #}
<header class="archive-header">
<header class="archive-header"> {# 归档页眉 #}
<p class="archive-title">{% trans 'article archive' %}</p>
<p class="archive-title">{% trans 'article archive' %}</p> {# 归档标题 #}
</header><!-- .archive-header -->
<div class="entry-content">
{% regroup article_list by pub_time.year as year_post_group %}
<ul>
{% for year in year_post_group %}
<li>{{ year.grouper }} {% trans 'year' %}
{% regroup year.list by pub_time.month as month_post_group %}
<ul>
{% for month in month_post_group %}
<li>{{ month.grouper }} {% trans 'month' %}
<ul>
{% for article in month.list %}
<li><a href="{{ article.get_absolute_url }}">{{ article.title }}</a>
<div class="entry-content"> {# 条目内容 #}
{% regroup article_list by pub_time.year as year_post_group %} {# 按年份分组文章 #}
<ul> {# 年份列表 #}
{% for year in year_post_group %} {# 遍历年份组 #}
<li>{{ year.grouper }} {% trans 'year' %} {# 显示年份 #}
{% regroup year.list by pub_time.month as month_post_group %} {# 按月份分组 #}
<ul> {# 月份列表 #}
{% for month in month_post_group %} {# 遍历月份组 #}
<li>{{ month.grouper }} {% trans 'month' %} {# 显示月份 #}
<ul> {# 文章列表 #}
{% for article in month.list %} {# 遍历文章 #}
<li><a href="{{ article.get_absolute_url }}">{{ article.title }}</a> {# 文章链接 #}
</li>
{% endfor %}
</ul>
@ -53,8 +53,6 @@
{% endblock %}
{% block sidebar %}
{% load_sidebar user 'i' %}
{% endblock %}
{% block sidebar %} {# 侧边栏块 #}
{% load_sidebar user 'i' %} {# 加载侧边栏内容 #}
{% endblock %}

@ -1,44 +1,44 @@
{% extends 'share_layout/base.html' %}
{% load blog_tags %}
{% extends 'share_layout/base.html' %} {# 继承基础布局模板 #}
{% load blog_tags %} {# 加载博客自定义标签 #}
{% block header %}
{% block header %} {# 头部内容块 #}
{% endblock %}
{% block content %}
<div id="primary" class="site-content">
<div id="content" role="main">
{% load_article_detail article False user %}
{% block content %} {# 主要内容块 #}
<div id="primary" class="site-content"> {# 主要内容区域 #}
<div id="content" role="main"> {# 内容区域 #}
{% load_article_detail article False user %} {# 加载文章详情内容 #}
{% if article.type == 'a' %}
<nav class="nav-single">
<h3 class="assistive-text">文章导航</h3>
{% if next_article %}
{% if article.type == 'a' %} {# 如果是文章类型 #}
<nav class="nav-single"> {# 单篇文章导航 #}
<h3 class="assistive-text">文章导航</h3> {# 辅助文本 #}
{% if next_article %} {# 如果存在下一篇文章 #}
<span class="nav-previous"><a href="{{ next_article.get_absolute_url }}" rel="prev"><span
class="meta-nav">&larr;</span> {{ next_article.title }}</a></span>
class="meta-nav">&larr;</span> {{ next_article.title }}</a></span> {# 上一篇链接 #}
{% endif %}
{% if prev_article %}
{% if prev_article %} {# 如果存在上一篇文章 #}
<span class="nav-next"><a href="{{ prev_article.get_absolute_url }}"
rel="next">{{ prev_article.title }} <span
class="meta-nav">&rarr;</span></a></span>
class="meta-nav">&rarr;</span></a></span> {# 下一篇链接 #}
{% endif %}
</nav><!-- .nav-single -->
{% endif %}
</div><!-- #content -->
{% if article.comment_status == "o" and OPEN_SITE_COMMENT %}
{% if article.comment_status == "o" and OPEN_SITE_COMMENT %} {# 如果评论开启且网站允许评论 #}
{% include 'comments/tags/comment_list.html' %}
{% if user.is_authenticated %}
{% include 'comments/tags/post_comment.html' %}
{% else %}
<div class="comments-area">
{% include 'comments/tags/comment_list.html' %} {# 包含评论列表模板 #}
{% if user.is_authenticated %} {# 如果用户已登录 #}
{% include 'comments/tags/post_comment.html' %} {# 包含发表评论模板 #}
{% else %} {# 如果用户未登录 #}
<div class="comments-area"> {# 评论区域 #}
<h3 class="comment-meta">您还没有登录,请您<a
href="{% url "account:login" %}?next={{ request.get_full_path }}" rel="nofollow">登录</a>后发表评论。
href="{% url "account:login" %}?next={{ request.get_full_path }}" rel="nofollow">登录</a>后发表评论。 {# 登录提示 #}
</h3>
{% load oauth_tags %}
{% load_oauth_applications request %}
{% load oauth_tags %} {# 加载OAuth标签 #}
{% load_oauth_applications request %} {# 加载OAuth应用 #}
</div>
{% endif %}
@ -47,6 +47,6 @@
{% endblock %}
{% block sidebar %}
{% load_sidebar user "p" %}
{% block sidebar %} {# 侧边栏块 #}
{% load_sidebar user "p" %} {# 加载侧边栏内容 #}
{% endblock %}

@ -1,42 +1,42 @@
{% extends 'share_layout/base.html' %}
{% load blog_tags %}
{% load cache %}
{% block header %}
{% if tag_name %}
<title>{{ page_type }}:{{ tag_name }} | {{ SITE_DESCRIPTION }}</title>
{% comment %}<meta name="description" content="{{ page_type }}:{{ tag_name }}"/>{% endcomment %}
{% else %}
<title>{{ SITE_NAME }} | {{ SITE_DESCRIPTION }}</title>
{% extends 'share_layout/base.html' %} {# 继承基础布局模板 #}
{% load blog_tags %} {# 加载博客自定义标签 #}
{% load cache %} {# 加载缓存标签 #}
{% block header %} {# 头部内容块 #}
{% if tag_name %} {# 如果存在标签名称 #}
<title>{{ page_type }}:{{ tag_name }} | {{ SITE_DESCRIPTION }}</title> {# 带标签的页面标题 #}
{% comment %}<meta name="description" content="{{ page_type }}:{{ tag_name }}"/>{% endcomment %} {# 注释掉的描述 #}
{% else %} {# 如果没有标签名称 #}
<title>{{ SITE_NAME }} | {{ SITE_DESCRIPTION }}</title> {# 默认页面标题 #}
{% endif %}
<meta name="description" content="{{ SITE_SEO_DESCRIPTION }}"/>
<meta name="keywords" content="{{ SITE_KEYWORDS }}"/>
<meta property="og:type" content="blog"/>
<meta property="og:title" content="{{ SITE_NAME }}"/>
<meta property="og:description" content="{{ SITE_DESCRIPTION }}"/>
<meta property="og:url" content="{{ SITE_BASE_URL }}"/>
<meta property="og:site_name" content="{{ SITE_NAME }}"/>
<meta name="description" content="{{ SITE_SEO_DESCRIPTION }}"/> {# 页面描述 #}
<meta name="keywords" content="{{ SITE_KEYWORDS }}"/> {# 页面关键词 #}
<meta property="og:type" content="blog"/> {# OpenGraph类型 #}
<meta property="og:title" content="{{ SITE_NAME }}"/> {# OpenGraph标题 #}
<meta property="og:description" content="{{ SITE_DESCRIPTION }}"/> {# OpenGraph描述 #}
<meta property="og:url" content="{{ SITE_BASE_URL }}"/> {# OpenGraph网址 #}
<meta property="og:site_name" content="{{ SITE_NAME }}"/> {# OpenGraph站点名称 #}
{% endblock %}
{% block content %}
<div id="primary" class="site-content">
<div id="content" role="main">
{% if page_type and tag_name %}
<header class="archive-header">
{% block content %} {# 主要内容块 #}
<div id="primary" class="site-content"> {# 主要内容区域 #}
<div id="content" role="main"> {# 内容区域 #}
{% if page_type and tag_name %} {# 如果存在页面类型和标签名称 #}
<header class="archive-header"> {# 归档页眉 #}
<p class="archive-title">{{ page_type }}<span>{{ tag_name }}</span></p>
<p class="archive-title">{{ page_type }}<span>{{ tag_name }}</span></p> {# 归档标题 #}
</header><!-- .archive-header -->
{% endif %}
{% for article in article_list %}
{% load_article_detail article True user %}
{% for article in article_list %} {# 遍历文章列表 #}
{% load_article_detail article True user %} {# 加载文章详情 #}
{% endfor %}
{% if is_paginated %}
{% load_pagination_info page_obj page_type tag_name %}
{% if is_paginated %} {# 如果启用了分页 #}
{% load_pagination_info page_obj page_type tag_name %} {# 加载分页信息 #}
{% endif %}
</div><!-- #content -->
</div><!-- #primary -->
{% endblock %}
{% block sidebar %}
{% load_sidebar user linktype %}
{% block sidebar %} {# 侧边栏块 #}
{% load_sidebar user linktype %} {# 加载侧边栏内容 #}
{% endblock %}

@ -1,35 +1,35 @@
{% extends 'share_layout/base.html' %}
{% load blog_tags %}
{% load cache %}
{% block header %}
{% if tag_name %}
{% if statuscode == '404' %}
<title>404 NotFound</title>
{% elif statuscode == '403' %}
<title>Permission Denied</title>
{% elif statuscode == '500' %}
<title>500 Error</title>
{% else %}
<title></title>
{% extends 'share_layout/base.html' %} {# 继承基础布局模板 #}
{% load blog_tags %} {# 加载博客自定义标签 #}
{% load cache %} {# 加载缓存标签 #}
{% block header %} {# 头部内容块 #}
{% if tag_name %} {# 如果存在标签名称 #}
{% if statuscode == '404' %} {# 如果是404状态码 #}
<title>404 NotFound</title> {# 404页面标题 #}
{% elif statuscode == '403' %} {# 如果是403状态码 #}
<title>Permission Denied</title> {# 403页面标题 #}
{% elif statuscode == '500' %} {# 如果是500状态码 #}
<title>500 Error</title> {# 500页面标题 #}
{% else %} {# 其他状态码 #}
<title></title> {# 空标题 #}
{% endif %}
{% comment %}<meta name="description" content="{{ page_type }}:{{ tag_name }}"/>{% endcomment %}
{% else %}
<title>{{ SITE_NAME }} | {{ SITE_DESCRIPTION }}</title>
{% comment %}<meta name="description" content="{{ page_type }}:{{ tag_name }}"/>{% endcomment %} {# 注释掉的描述 #}
{% else %} {# 如果没有标签名称 #}
<title>{{ SITE_NAME }} | {{ SITE_DESCRIPTION }}</title> {# 默认页面标题 #}
{% endif %}
<meta name="description" content="{{ SITE_SEO_DESCRIPTION }}"/>
<meta name="keywords" content="{{ SITE_KEYWORDS }}"/>
<meta property="og:type" content="blog"/>
<meta property="og:title" content="{{ SITE_NAME }}"/>
<meta property="og:description" content="{{ SITE_DESCRIPTION }}"/>
<meta property="og:url" content="{{ SITE_BASE_URL }}"/>
<meta property="og:site_name" content="{{ SITE_NAME }}"/>
<meta name="description" content="{{ SITE_SEO_DESCRIPTION }}"/> {# 页面描述 #}
<meta name="keywords" content="{{ SITE_KEYWORDS }}"/> {# 页面关键词 #}
<meta property="og:type" content="blog"/> {# OpenGraph类型 #}
<meta property="og:title" content="{{ SITE_NAME }}"/> {# OpenGraph标题 #}
<meta property="og:description" content="{{ SITE_DESCRIPTION }}"/> {# OpenGraph描述 #}
<meta property="og:url" content="{{ SITE_BASE_URL }}"/> {# OpenGraph网址 #}
<meta property="og:site_name" content="{{ SITE_NAME }}"/> {# OpenGraph站点名称 #}
{% endblock %}
{% block content %}
<div id="primary" class="site-content">
<div id="content" role="main">
{% block content %} {# 主要内容块 #}
<div id="primary" class="site-content"> {# 主要内容区域 #}
<div id="content" role="main"> {# 内容区域 #}
<header class="archive-header">
<h1 class="archive-title">{{ message }}</h1>
<header class="archive-header"> {# 归档页眉 #}
<h1 class="archive-title">{{ message }}</h1> {# 显示错误消息 #}
</header><!-- .archive-header -->
</div><!-- #content -->
@ -38,8 +38,6 @@
{% endblock %}
{% block sidebar %}
{% load_sidebar user 'i' %}
{% endblock %}
{% block sidebar %} {# 侧边栏块 #}
{% load_sidebar user 'i' %} {# 加载侧边栏内容 #}
{% endblock %}

@ -3,31 +3,31 @@
{% load cache %}
{% block header %}
<title>友情链接 | {{ SITE_DESCRIPTION }}</title>
<title>友情链接 | {{ SITE_DESCRIPTION }}</title> {# 友情链接页面标题 #}
<meta name="description" content="{{ SITE_SEO_DESCRIPTION }}"/>
<meta name="keywords" content="{{ SITE_KEYWORDS }}"/>
<meta property="og:type" content="blog"/>
<meta property="og:title" content="{{ SITE_NAME }}"/>
<meta property="og:description" content="{{ SITE_DESCRIPTION }}"/>
<meta property="og:url" content="{{ SITE_BASE_URL }}"/>
<meta property="og:site_name" content="{{ SITE_NAME }}"/>
<meta name="description" content="{{ SITE_SEO_DESCRIPTION }}"/> {# 页面描述 #}
<meta name="keywords" content="{{ SITE_KEYWORDS }}"/> {# 页面关键词 #}
<meta property="og:type" content="blog"/> {# OpenGraph类型 #}
<meta property="og:title" content="{{ SITE_NAME }}"/> {# OpenGraph标题 #}
<meta property="og:description" content="{{ SITE_DESCRIPTION }}"/> {# OpenGraph描述 #}
<meta property="og:url" content="{{ SITE_BASE_URL }}"/> {# OpenGraph网址 #}
<meta property="og:site_name" content="{{ SITE_NAME }}"/> {# OpenGraph站点名称 #}
{% endblock %}
{% block content %}
<div id="primary" class="site-content">
<div id="content" role="main">
{% block content %} {# 主要内容块 #}
<div id="primary" class="site-content"> {# 主要内容区域 #}
<div id="content" role="main"> {# 内容区域 #}
<header class="archive-header">
<header class="archive-header"> {# 归档页眉 #}
<p class="archive-title">友情链接</p>
<p class="archive-title">友情链接</p> {# 友情链接标题 #}
</header><!-- .archive-header -->
<div class="entry-content">
<ul>
{% for obj in object_list %}
<div class="entry-content"> {# 条目内容 #}
<ul> {# 链接列表 #}
{% for obj in object_list %} {# 遍历友情链接对象列表 #}
<li>
<a href="{{ obj.link }}">{{ obj.name }}</a>
<a href="{{ obj.link }}">{{ obj.name }}</a> {# 显示链接名称和URL #}
</li>
{% endfor %} </ul>
</div>
@ -37,8 +37,6 @@
{% endblock %}
{% block sidebar %}
{% load_sidebar user 'i' %}
{% endblock %}
{% block sidebar %} {# 侧边栏块 #}
{% load_sidebar user 'i' %} {# 加载侧边栏内容 #}
{% endblock %}

@ -4,71 +4,78 @@
<article id="post-{{ article.pk }} "
class="post-{{ article.pk }} post type-post status-publish format-standard hentry">
<header class="entry-header">
{# 文章标题 #}
<h1 class="entry-title">
{% if isindex %}
{% if isindex %}
{% if article.article_order > 0 %}
{# 置顶文章显示特殊标识 #}
<a href="{{ article.get_absolute_url }}"
rel="bookmark">【{% trans 'pin to top' %}】{{ article.title }}</a>
{% else %}
{# 普通文章标题链接 #}
<a href="{{ article.get_absolute_url }}"
rel="bookmark">{{ article.title }}</a>
{% endif %}
{% else %}
{# 文章详情页直接显示标题 #}
{{ article.title }}
{% endif %}
</h1>
{# 评论链接和浏览量 #}
<div class="comments-link">
{% if article.comment_status == "o" and open_site_comment %}
{# 显示评论数量和链接 #}
<a href="{{ article.get_absolute_url }}#comments" class="ds-thread-count" data-thread-key="3815"
rel="nofollow">
<span class="leave-reply">
{% if article.comment_set and article.comment_set.count %}
{{ article.comment_set.count }} {% trans 'comments' %}
{{ article.comment_set.count }} {% trans 'comments' %} {# 多条评论 #}
{% else %}
{% trans 'comment' %}
{% trans 'comment' %} {# 单数评论 #}
{% endif %}
</span>
</a>
{% endif %}
{# 文章浏览量 #}
<div style="float:right">
{{ article.views }} views
</div>
</div><!-- .comments-link -->
<br/>
{# 面包屑导航(仅文章类型且非首页) #}
{% if article.type == 'a' %}
{% if not isindex %}
{% cache 36000 breadcrumb article.pk %}
{% load_breadcrumb article %}
{% cache 36000 breadcrumb article.pk %} {# 缓存面包屑10小时 #}
{% load_breadcrumb article %} {# 加载面包屑导航 #}
{% endcache %}
{% endif %}
{% endif %}
</header><!-- .entry-header -->
<div class="entry-content" itemprop="articleBody">
{% if isindex %}
{{ article.body|custom_markdown|escape|truncatechars_content }}
<p class='read-more'><a
href=' {{ article.get_absolute_url }}'>Read more</a></p>
{% if isindex %}
{# 首页文章摘要 #}
{{ article.body|custom_markdown|escape|truncatechars_content }} {# 截断显示 #}
<p class='read-more'><a href='{{ article.get_absolute_url }}'>Read more</a></p> {# 阅读更多链接 #}
{% else %}
{# 文章详情页内容 #}
{% if article.show_toc %}
{# 显示文章目录 #}
{% get_markdown_toc article.body as toc %}
<b>{% trans 'toc' %}:</b>
{{ toc|safe }}
<hr class="break_line"/>
{{ toc|safe }} {# 安全渲染HTML目录 #}
<hr class="break_line"/> {# 分隔线 #}
{% endif %}
<div class="article">
{{ article.body|custom_markdown|escape }}
{# 完整文章内容 #}
{{ article.body|custom_markdown|escape }} {# 渲染Markdown内容 #}
</div>
{% endif %}
</div><!-- .entry-content -->
{# 加载文章元数据(标签、分类等) #}
{% load_article_metas article user %}
</article><!-- #post -->

@ -1,59 +1,51 @@
{% load i18n %}
{% load blog_tags %}
<footer class="entry-meta">
{% trans 'posted in' %}
{% trans 'posted in' %} {# 分类信息 #}
<a href="{{ article.category.get_absolute_url }}" rel="category tag">{{ article.category.name }}</a>
</a>
{% if article.type == 'a' %}
{% if article.tags.all %}
{% trans 'and tagged' %}
{% for t in article.tags.all %}
<a href="{{ t.get_absolute_url }}" rel="tag">{{ t.name }}</a>
{% if t != article.tags.all.last %}
{% if article.type == 'a' %} {# 仅文章类型显示标签 #}
{% if article.tags.all %} {# 如果有标签 #}
{% trans 'and tagged' %} {# 标签信息 #}
{% for t in article.tags.all %} {# 遍历所有标签 #}
<a href="{{ t.get_absolute_url }}" rel="tag">{{ t.name }}</a> {# 单个标签链接 #}
{% if t != article.tags.all.last %} {# 非最后一个标签加逗号 #}
,
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
.{% trans 'by ' %}
.{% trans 'by ' %} {# 作者信息 #}
<span class="by-author">
<span class="author vcard">
<a class="url fn n" href="{{ article.author.get_absolute_url }}"
{% blocktranslate %}
title="View all articles published by {{ article.author.username }}"
title="View all articles published by {{ article.author.username }}" {# 作者页面提示 #}
{% endblocktranslate %}
rel="author">
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
<span itemprop="name" itemprop="publisher">
{{ article.author.username }}
</span>
<span itemprop="author" itemscope itemtype="http://schema.org/Person"> {# 结构化数据 #}
<span itemprop="name" itemprop="publisher">
{{ article.author.username }} {# 作者用户名 #}
</span>
</span>
</a>
</a>
</span>
{% trans 'on' %}
<a href="{{ article.get_absolute_url }}"
title="{% datetimeformat article.pub_time %}"
itemprop="datePublished" content="{% datetimeformat article.pub_time %}"
rel="bookmark">
<time class="entry-date updated"
datetime="{{ article.pub_time }}">
{% datetimeformat article.pub_time %}</time>
{% if user.is_superuser %}
<a href="{{ article.get_admin_url }}">{% trans 'edit' %}</a>
{% endif %}
{% trans 'on' %} {# 发布时间 #}
<a href="{{ article.get_absolute_url }}"
title="{% datetimeformat article.pub_time %}" {# 发布时间提示 #}
itemprop="datePublished" content="{% datetimeformat article.pub_time %}"
rel="bookmark">
<time class="entry-date updated"
datetime="{{ article.pub_time }}"> {# 时间语义化标签 #}
{% datetimeformat article.pub_time %} {# 格式化显示时间 #}
</time>
</a>
{% if user.is_superuser %} {# 管理员显示编辑链接 #}
<a href="{{ article.get_admin_url }}">{% trans 'edit' %}</a> {# 编辑文章链接 #}
{% endif %}
</span>
</footer><!-- .entry-meta -->
</footer><!-- .entry-meta -->

@ -1,17 +1,21 @@
{% load i18n %}
<nav id="nav-below" class="navigation" role="navigation">
<h3 class="assistive-text">
{% trans 'article navigation' %}
{% trans 'article navigation' %} {# 屏幕阅读器使用的导航标题 #}
</h3>
{% if page_obj.has_next and next_url%}
<div class="nav-previous"><a
href="{{ next_url }}"><span
class="meta-nav">&larr;</span> {% trans 'earlier articles' %}</a></div>
{% if page_obj.has_next and next_url %} {# 检查是否有更早的文章 #}
<div class="nav-previous">
<a href="{{ next_url }}"> {# 上一页链接 #}
<span class="meta-nav">&larr;</span> {% trans 'earlier articles' %} {# 向左箭头和文字 #}
</a>
</div>
{% endif %}
{% if page_obj.has_previous and previous_url %}
<div class="nav-next"><a href="{{ previous_url }}">{% trans 'newer articles' %}
<span
class="meta-nav">→</span></a>
{% if page_obj.has_previous and previous_url %} {# 检查是否有更新的文章 #}
<div class="nav-next">
<a href="{{ previous_url }}"> {# 下一页链接 #}
{% trans 'newer articles' %} {# 更新的文章文字 #}
<span class="meta-nav"></span> {# 向右箭头 #}
</a>
</div>
{% endif %}
</nav><!-- .navigation -->

@ -1,19 +1,17 @@
{% load i18n %}
{% if article_tags_list %}
<div class="panel panel-default">
{% if article_tags_list %} {# 检查是否存在标签列表 #}
<div class="panel panel-default"> {# Bootstrap面板容器 #}
<div class="panel-heading">
{% trans 'tags' %}
{% trans 'tags' %} {# 面板标题:标签 #}
</div>
<div class="panel-body">
{% for url,count,tag,color in article_tags_list %}
{% for url,count,tag,color in article_tags_list %} {# 遍历标签数据 #}
<a class="label label-{{ color }}" style="display: inline-block;" href="{{ url }}"
title="{{ tag.name }}">
{{ tag.name }}
<span class="badge">{{ count }}</span>
title="{{ tag.name }}"> {# 标签链接,显示颜色和提示文字 #}
{{ tag.name }} {# 标签名称 #}
<span class="badge">{{ count }}</span> {# 标签对应的文章数量 #}
</a>
{% endfor %}
</div>
</div>
{% endif %}
{% endif %}

@ -1,19 +1,15 @@
<ul itemscope itemtype="https://schema.org/BreadcrumbList" class="breadcrumb">
{% for name,url in names %}
<ul itemscope itemtype="https://schema.org/BreadcrumbList" class="breadcrumb"> {# 面包屑导航使用Schema.org结构化数据 #}
{% for name,url in names %} {# 遍历面包屑路径 #}
<li itemprop="itemListElement" itemscope
itemtype="https://schema.org/ListItem">
<a href="{{ url }}" itemprop="item" >
<span itemprop="name">{{ name }}</span></a>
<meta itemprop="position" content="{{ forloop.counter }}"/>
itemtype="https://schema.org/ListItem"> {# 列表项结构化数据 #}
<a href="{{ url }}" itemprop="item"> {# 可点击的面包屑链接 #}
<span itemprop="name">{{ name }}</span></a> {# 链接文本 #}
<meta itemprop="position" content="{{ forloop.counter }}"/> {# 当前位置序号 #}
</li>
{% endfor %}
<li class="active" itemprop="itemListElement" itemscope
itemtype="https://schema.org/ListItem">
<span itemprop="name">{{ title }}</span>
<meta itemprop="position" content="{{ count }}"/>
itemtype="https://schema.org/ListItem"> {# 当前页面包屑(不可点击) #}
<span itemprop="name">{{ title }}</span> {# 当前页面标题 #}
<meta itemprop="position" content="{{ count }}"/> {# 总位置数 #}
</li>
</ul>
</ul>

@ -1,136 +1,149 @@
django
{% load blog_tags %}
{% load i18n %}
<div id="secondary" class="widget-area" role="complementary">
<div id="secondary" class="widget-area" role="complementary"> {# 侧边栏容器 #}
{# 搜索框部件 #}
<aside id="search-2" class="widget widget_search">
<form role="search" method="get" id="searchform" class="searchform" action="/search">
<form role="search" method="get" id="searchform" class="searchform" action="/search"> {# 搜索表单 #}
<div>
<label class="screen-reader-text" for="s">{% trans 'search' %}</label>
<input type="text" value="" name="q" id="q"/>
<input type="submit" id="searchsubmit" />
<input type="text" value="" name="q" id="q"/> {# 搜索输入框 #}
<input type="submit" id="searchsubmit" /> {# 搜索提交按钮 #}
</div>
</form>
</aside>
{# 自定义侧边栏内容 #}
{% if extra_sidebars %}
{% for sidebar in extra_sidebars %}
<aside class="widget_text widget widget_custom_html"><p class="widget-title">
{{ sidebar.name }}</p>
{{ sidebar.name }}</p> {# 侧边栏标题 #}
<div class="textwidget custom-html-widget">
{{ sidebar.content|custom_markdown|safe }}
{{ sidebar.content|custom_markdown|safe }} {# 渲染Markdown内容 #}
</div>
</aside>
{% endfor %}
{% endif %}
{# 热门文章部件 #}
{% if most_read_articles %}
<aside id="views-4" class="widget widget_views"><p class="widget-title">Views</p>
<ul>
{% for a in most_read_articles %}
<li>
<a href="{{ a.get_absolute_url }}" title="{{ a.title }}">
{{ a.title }}
</a> - {{ a.views }} views
{{ a.title }} {# 文章标题 #}
</a> - {{ a.views }} views {# 浏览量 #}
</li>
{% endfor %}
</ul>
</aside>
{% endif %}
{# 分类列表部件 #}
{% if sidebar_categorys %}
<aside id="su_siloed_terms-2" class="widget widget_su_siloed_terms"><p class="widget-title">{% trans 'category' %}</p>
<ul>
{% for c in sidebar_categorys %}
<li class="cat-item cat-item-184"><a href={{ c.get_absolute_url }}>{{ c.name }}</a>
<li class="cat-item cat-item-184"><a href={{ c.get_absolute_url }}>{{ c.name }}</a> {# 分类链接 #}
</li>
{% endfor %}
</ul>
</aside>
{% endif %}
{% if sidebar_comments and open_site_comment %}
{# 最新评论部件 #}
{% if sidebar_comments and open_site_comment %} {# 检查评论功能是否开启 #}
<aside id="ds-recent-comments-4" class="widget ds-widget-recent-comments"><p class="widget-title">{% trans 'recent comments' %}</p>
<ul id="recentcomments">
{% for c in sidebar_comments %}
<li class="recentcomments">
<span class="comment-author-link">
{{ c.author.username }}</span>
{% trans 'published on' %}《
<span class="comment-author-link">
{{ c.author.username }}</span> {# 评论作者 #}
{% trans 'published on' %}《 {# 评论所在文章 #}
<a href="{{ c.article.get_absolute_url }}#comment-{{ c.pk }}">{{ c.article.title }}</a>
</li>
{% endfor %}
</ul>
</aside>
{% endif %}
{# 最新文章部件 #}
{% if recent_articles %}
<aside id="recent-posts-2" class="widget widget_recent_entries"><p class="widget-title">{% trans 'recent articles' %}</p>
<ul>
{% for a in recent_articles %}
{% for a in recent_articles %}
<li><a href="{{ a.get_absolute_url }}" title="{{ a.title }}">
{{ a.title }}
{{ a.title }} {# 文章标题 #}
</a></li>
{% endfor %}
</ul>
</aside>
{% endif %}
{# 书签链接部件 #}
{% if sidabar_links %}
<aside id="linkcat-0" class="widget widget_links"><p class="widget-title">{% trans 'bookmark' %}</p>
<ul class='xoxo blogroll'>
{% for l in sidabar_links %}
<li>
<a href="{{ l.link }}" target="_blank" title="{{ l.name }}">{{ l.name }}</a>
<a href="{{ l.link }}" target="_blank" title="{{ l.name }}">{{ l.name }}</a> {# 外部链接 #}
</li>
{% endfor %}
</ul>
</aside>
{% endif %}
{# Google广告部件 #}
{% if show_google_adsense %}
<aside id="text-2" class="widget widget_text"><p class="widget-title">Google AdSense</p>
<div class="textwidget">
{{ google_adsense_codes|safe }}
{{ google_adsense_codes|safe }} {# 广告代码 #}
</div>
</aside>
{% endif %}
{# 标签云部件 #}
{% if sidebar_tags %}
<aside id="tag_cloud-2" class="widget widget_tag_cloud"><p class="widget-title">{% trans 'Tag Cloud' %}</p>
<div class="tagcloud">
{% for tag,count,size in sidebar_tags %}
{% for tag,count,size in sidebar_tags %} {# 标签数据包含大小信息 #}
<a href="{{ tag.get_absolute_url }}"
class="tag-link-{{ tag.id }} tag-link-position-{{ tag.id }}"
style="font-size: {{ size }}pt;" title="{{ count }}个话题"> {{ tag.name }}
style="font-size: {{ size }}pt;" title="{{ count }}个话题"> {{ tag.name }} {# 根据热度调整字体大小 #}
</a>
{% endfor %}
</div>
</aside>
{% endif %}
{# GitHub星标部件 #}
<aside id="text-2" class="widget widget_text"><p class="widget-title">{% trans 'Welcome to star or fork the source code of this site' %}</p>
<div class="textwidget">
<p><a href="https://github.com/liangliangyy/DjangoBlog" rel="nofollow"><img
src="https://resource.lylinux.net/img.shields.io/github/stars/liangliangyy/djangoblog.svg?style=social&amp;label=Star"
alt="GitHub stars"></a> <a href="https://github.com/liangliangyy/DjangoBlog" rel="nofollow"><img
src="https://resource.lylinux.net/img.shields.io/github/forks/liangliangyy/djangoblog.svg?style=social&amp;label=Fork"
alt="GitHub forks"></a></p>
alt="GitHub forks"></a></p> {# GitHub统计徽章 #}
</div>
</aside>
{# 功能链接部件 #}
<aside id="meta-3" class="widget widget_meta"><p class="widget-title">{% trans 'Function' %}</p>
<ul>
<li><a href="/admin/" rel="nofollow">{% trans 'management site' %}</a></li>
{% if user.is_authenticated %}
<li><a href="{% url "account:logout" %}" rel="nofollow">{% trans 'logout' %}</a>
</li>
<li><a href="/admin/" rel="nofollow">{% trans 'management site' %}</a></li> {# 管理后台 #}
{% if user.is_authenticated %} {# 用户认证状态判断 #}
<li><a href="{% url "account:logout" %}" rel="nofollow">{% trans 'logout' %}</a></li>
{% else %}
<li><a href="{% url "account:login" %}" rel="nofollow">{% trans 'login' %}</a></li>
<li><a href="{% url "account:login" %}" rel="nofollow">{% trans 'login' %}</a></li> {# 登录链接 #}
{% endif %}
{% if user.is_superuser %}
{% if user.is_superuser %} {# 管理员专属功能 #}
<li><a href="{% url 'owntracks:show_dates' %}" target="_blank">{% trans 'Track record' %}</a></li>
{% endif %}
<li><a href="http://gitbook.lylinux.net" target="_blank" rel="nofollow">GitBook</a></li>
<li><a href="http://gitbook.lylinux.net" target="_blank" rel="nofollow">GitBook</a></li> {# 外部资源 #}
</ul>
</aside>
{# 返回顶部按钮 #}
<div id="rocket" class="show" title="{% trans 'Click me to return to the top' %}"></div>
</div><!-- #secondary -->
</div><!-- #secondary -->

@ -1,34 +1,34 @@
{% load blog_tags %}
<li class="comment even thread-even depth-{{ depth }} parent" id="comment-{{ comment_item.pk }}">
<div id="div-comment-{{ comment_item.pk }}" class="comment-body">
<div class="comment-author vcard">
{% load blog_tags %} {# 加载博客自定义标签 #}
<li class="comment even thread-even depth-{{ depth }} parent" id="comment-{{ comment_item.pk }}"> {# 评论列表项包含深度和ID #}
<div id="div-comment-{{ comment_item.pk }}" class="comment-body"> {# 评论主体容器 #}
<div class="comment-author vcard"> {# 评论作者信息 #}
<img alt=""
src="{{ comment_item.author.email|gravatar_url:150 }}"
srcset="{{ comment_item.author.email|gravatar_url:150 }}"
src="{{ comment_item.author.email | gravatar_url:150 }}" {# 使用Gravatar显示头像 #}
srcset="{{ comment_item.author.email | gravatar_url:150 }}"
class="avatar avatar-96 photo" height="96" width="96">
<cite class="fn">
<cite class="fn"> {# 作者姓名 #}
<a rel="nofollow"
{% if comment_item.author.is_superuser %}
href="{{ comment_item.author.get_absolute_url }}"
{% else %}
href="#"
{% if comment_item.author.is_superuser %} {# 如果是超级用户 #}
href="{{ comment_item.author.get_absolute_url }}" {# 链接到作者页面 #}
{% else %} {# 如果不是超级用户 #}
href="#" {# 空链接 #}
{% endif %}
rel="external nofollow"
class="url">{{ comment_item.author.username }}
class="url">{{ comment_item.author.username }} {# 显示用户名 #}
</a>
</cite>
</div>
<div class="comment-meta commentmetadata">
<div>{{ comment_item.creation_time }}</div>
<div>回复给:@{{ comment_item.author.parent_comment.username }}</div>
<div class="comment-meta commentmetadata"> {# 评论元数据 #}
<div>{{ comment_item.creation_time }}</div> {# 评论创建时间 #}
<div>回复给:@{{ comment_item.author.parent_comment.username }}</div> {# 回复对象 #}
</div>
<p>{{ comment_item.body|escape|comment_markdown }}</p>
<div class="reply"><a rel="nofollow" class="comment-reply-link"
<p>{{ comment_item.body | escape | comment_markdown }}</p> {# 评论内容转义并Markdown渲染 #}
<div class="reply"><a rel="nofollow" class="comment-reply-link" {# #}
href="javascript:void(0)"
onclick="do_reply({{ comment_item.pk }})"
aria-label="回复给{{ comment_item.author.username }}">回复</a></div>
onclick="do_reply({{ comment_item.pk }})" {# 点击回复函数 #}
aria-label="回复给{{ comment_item.author.username }}">回复</a></div> {# 可访问性标签 #}
</div>
</li><!-- #comment-## -->
</li><!-- #comment-## --> {# 评论项结束 #}

@ -1,53 +1,53 @@
{% load blog_tags %}
{% load blog_tags %} {# 加载博客自定义标签 #}
<li class="comment even thread-even depth-{{ depth }} parent" id="comment-{{ comment_item.pk }}"
style="margin-left: {% widthratio depth 1 3 %}rem">
<div id="div-comment-{{ comment_item.pk }}" class="comment-body">
<div class="comment-author vcard">
style="margin-left: {% widthratio depth 1 3 %}rem"> {# 根据评论深度设置左边距 #}
<div id="div-comment-{{ comment_item.pk }}" class="comment-body"> {# 评论主体容器 #}
<div class="comment-author vcard"> {# 评论作者信息 #}
<img alt=""
src="{{ comment_item.author.email|gravatar_url:150 }}"
srcset="{{ comment_item.author.email|gravatar_url:150 }}"
src="{{ comment_item.author.email | gravatar_url:150 }}" {# 使用Gravatar显示头像 #}
srcset="{{ comment_item.author.email | gravatar_url:150 }}"
class="avatar avatar-96 photo" height="96" width="96">
<cite class="fn">
<cite class="fn"> {# 作者姓名 #}
<a rel="nofollow"
{% if comment_item.author.is_superuser %}
href="{{ comment_item.author.get_absolute_url }}"
{% else %}
href="#"
{% if comment_item.author.is_superuser %} {# 如果是超级用户 #}
href="{{ comment_item.author.get_absolute_url }}" {# 链接到作者页面 #}
{% else %} {# 如果不是超级用户 #}
href="#" {# 空链接 #}
{% endif %}
rel="external nofollow"
class="url">{{ comment_item.author.username }}
class="url">{{ comment_item.author.username }} {# 显示用户名 #}
</a>
</cite>
</div>
<div class="comment-meta commentmetadata">
{{ comment_item.creation_time }}
<div class="comment-meta commentmetadata"> {# 评论元数据 #}
{{ comment_item.creation_time }} {# 评论创建时间 #}
</div>
<p>
{% if comment_item.parent_comment %}
{% if comment_item.parent_comment %} {# 如果存在父评论 #}
<div>回复 <a
href="#comment-{{ comment_item.parent_comment.pk }}">@{{ comment_item.parent_comment.author.username }}</a>
href="#comment-{{ comment_item.parent_comment.pk }}">@{{ comment_item.parent_comment.author.username }}</a> {# 链接到父评论 #}
</div>
{% endif %}
</p>
<p>{{ comment_item.body|escape|comment_markdown }}</p>
<p>{{ comment_item.body | escapecomment_markdown }}</p> {# 评论内容转义并Markdown渲染 #}
<div class="reply"><a rel="nofollow" class="comment-reply-link"
href="javascript:void(0)" data-pk="{{ comment_item.pk }}"
aria-label="回复给{{ comment_item.author.username }}">回复</a></div>
<div class="reply"><a rel="nofollow" class="comment-reply-link" {# #}
href="javascript:void(0)" data-pk="{{ comment_item.pk }}" {# 存储评论ID #}
aria-label="回复给{{ comment_item.author.username }}">回复</a></div> {# 可访问性标签 #}
</div>
</li><!-- #comment-## -->
{% query article_comments parent_comment=comment_item as cc_comments %}
{% for cc in cc_comments %}
{% with comment_item=cc template_name="comments/tags/comment_item_tree.html" %}
{% if depth >= 1 %}
{% include template_name %}
{% else %}
{% with depth=depth|add:1 %}
{% include template_name %}
</li><!-- #comment-## --> {# 评论项结束 #}
{% query article_comments parent_comment=comment_item as cc_comments %} {# 查询子评论 #}
{% for cc in cc_comments %} {# 遍历子评论 #}
{% with comment_item=cc template_name="comments/tags/comment_item_tree.html" %} {# 传递变量到子模板 #}
{% if depth >= 1 %} {# 如果深度大于等于1 #}
{% include template_name %} {# 包含评论树模板 #}
{% else %} {# 如果深度为0 #}
{% with depth=depth|add:1 %} {# 深度加1 #}
{% include template_name %} {# 包含评论树模板 #}
{% endwith %}
{% endif %}
{% endwith %}

@ -1,38 +1,38 @@
<dev>
<section id="comments" class="themeform">
{% load blog_tags %}
{% load comments_tags %}
{% load cache %}
<dev> {# 应该是div标签可能是拼写错误 #}
<section id="comments" class="themeform"> {# 评论区域 #}
{% load blog_tags %} {# 加载博客自定义标签 #}
{% load comments_tags %} {# 加载评论标签 #}
{% load cache %} {# 加载缓存标签 #}
<ul class="comment-tabs group">
<li class="active"><a href="#commentlist-container"><i
class="fa fa-comments-o"></i>评论<span>{{ comment_count }}</span></a></li>
<ul class="comment-tabs group"> {# 评论标签页 #}
<li class="active"><a href="#commentlist-container"><i {# #}
class="fa fa-comments-o"></i>评论<span>{{ comment_count }}</span></a></li> {# 显示评论数量 #}
</ul>
{% if article_comments %}
<div id="commentlist-container" class="comment-tab" style="display: block;">
<ol class="commentlist">
{# {% query article_comments parent_comment=None as parent_comments %}#}
{% for comment_item in p_comments %}
{% if article_comments %} {# 如果存在文章评论 #}
<div id="commentlist-container" class="comment-tab" style="display: block;"> {# 评论列表容器 #}
<ol class="commentlist"> {# 评论有序列表 #}
{# {% query article_comments parent_comment=None as parent_comments %}#} {# 注释掉的查询父评论代码 #}
{% for comment_item in p_comments %} {# 遍历父评论 #}
{% with 0 as depth %}
{% include "comments/tags/comment_item_tree.html" %}
{% with 0 as depth %} {# 设置初始深度为0 #}
{% include "comments/tags/comment_item_tree.html" %} {# 包含评论树模板 #}
{% endwith %}
{% endfor %}
</ol><!--/.commentlist-->
<div class="navigation">
<nav class="nav-single">
{% if comment_prev_page_url %}
<div class="nav-previous">
<div class="navigation"> {# 分页导航 #}
<nav class="nav-single"> {# 单页导航 #}
{% if comment_prev_page_url %} {# 如果存在上一页链接 #}
<div class="nav-previous"> {# 上一页按钮 #}
<span><a href="{{ comment_prev_page_url }}" rel="prev"><span
class="meta-nav">←</span> 上一页</a></span>
class="meta-nav">←</span> 上一页</a></span> {# 上一页链接 #}
</div>
{% endif %}
{% if comment_next_page_url %}
<div class="nav-next">
{% if comment_next_page_url %} {# 如果存在下一页链接 #}
<div class="nav-next"> {# 下一页按钮 #}
<span><a href="{{ comment_next_page_url }}" rel="next">下一页 <span
class="meta-nav">→</span></a></span>
class="meta-nav">→</span></a></span> {# 下一页链接 #}
</div>
{% endif %}
</nav>
@ -42,4 +42,4 @@
{% endif %}
</section>
</dev>
</dev> {# 应该是div结束标签 #}

@ -1,33 +1,31 @@
<div id="comments" class="comments-area">
<div id="comments" class="comments-area"> {# 评论区域容器 #}
<div id="respond" class="comment-respond">
<h3 id="reply-title" class="comment-reply-title">发表评论
<div id="respond" class="comment-respond"> {# 评论回复表单容器 #}
<h3 id="reply-title" class="comment-reply-title">发表评论 {# 评论表单标题 #}
<small><a rel="nofollow" id="cancel-comment-reply-link" href="/wordpress/?p=3786#respond"
style="display:none;">取消回复</a></small>
style="display:none;">取消回复</a></small> {# 隐藏的取消回复链接 #}
</h3>
<form action="{% url 'comments:postcomment' article.pk %}" method="post" id="commentform"
class="comment-form">{% csrf_token %}
<p class="comment-form-comment">
{{ form.body.label_tag }}
<form action="{% url 'comments:postcomment' article.pk %}" method="post" id="commentform" {# URL #}
class="comment-form">{% csrf_token %} {# CSRF令牌保护 #}
<p class="comment-form-comment"> {# 评论内容字段 #}
{{ form.body.label_tag }} {# 评论内容标签 #}
{{ form.body }}
{{ form.body.errors }}
{{ form.body }} {# 评论内容输入框 #}
{{ form.body.errors }} {# 评论内容错误提示 #}
</p>
{{ form.parent_comment_id }}
<div class="form-submit">
{% if COMMENT_NEED_REVIEW %}
<span class="comment-markdown"> 支持markdown评论经审核后才会显示。</span>
{% else %}
<span class="comment-markdown"> 支持markdown。</span>
{{ form.parent_comment_id }} {# 隐藏的父评论ID字段 #}
<div class="form-submit"> {# 表单提交区域 #}
{% if COMMENT_NEED_REVIEW %} {# 如果评论需要审核 #}
<span class="comment-markdown"> 支持markdown评论经审核后才会显示。</span> {# 审核提示 #}
{% else %} {# 如果评论不需要审核 #}
<span class="comment-markdown"> 支持markdown。</span> {# 普通提示 #}
{% endif %}
<input name="submit" type="submit" id="submit" class="submit" value="发表评论"/>
<small class="cancel-comment" id="cancel_comment" style="display: none">
<a href="javascript:void(0)" id="cancel-comment-reply-link" onclick="cancel_reply()">取消回复</a>
<input name="submit" type="submit" id="submit" class="submit" value="发表评论"/> {# 提交按钮 #}
<small class="cancel-comment" id="cancel_comment" style="display: none"> {# 隐藏的取消回复区域 #}
<a href="javascript:void(0)" id="cancel-comment-reply-link" onclick="cancel_reply()">取消回复</a> {# 取消回复链接 #}
</small>
</div>
</form>
</div><!-- #respond -->
</div><!-- #comments .comments-area -->
</div><!-- #respond --> {# 评论回复表单结束 #}
</div><!-- #comments .comments-area --> {# 评论区域结束 #}

@ -1,22 +1,22 @@
{% extends 'share_layout/base.html' %}
{% block header %}
<title> {{ title }}</title>
{% extends 'share_layout/base.html' %} {# 继承基础布局模板 #}
{% block header %} {# 头部内容块 #}
<title> {{ title }}</title> {# 动态页面标题 #}
{% endblock %}
{% block content %}
<div id="primary" class="site-content">
<div id="content" role="main">
{% block content %} {# 主要内容块 #}
<div id="primary" class="site-content"> {# 主要内容区域 #}
<div id="content" role="main"> {# 内容区域 #}
<header class="archive-header">
<header class="archive-header"> {# 归档页眉 #}
<h2 class="archive-title"> {{ content }}</h2>
<h2 class="archive-title"> {{ content }}</h2> {# 动态显示内容 #}
</header><!-- .archive-header -->
<br/>
<header class="archive-header" style="text-align: center">
<header class="archive-header" style="text-align: center"> {# 居中对齐的归档页眉 #}
<a href="{% url "account:login" %}">登录</a>
<a href="{% url "account:login" %}">登录</a> {# 登录页面链接 #}
|
<a href="/">回到首页</a>
<a href="/">回到首页</a> {# 首页链接 #}
</header><!-- .archive-header -->
</div>
</div>
{% endblock %}
{% endblock %}

@ -1,13 +1,13 @@
{% load i18n %}
<div class="widget-login">
{% if apps %}
{% load i18n %} {# 加载国际化标签 #}
<div class="widget-login"> {# 登录小部件容器 #}
{% if apps %} {# 如果存在OAuth应用 #}
<small>
{% trans 'quick login' %}:
{% trans 'quick login' %}: {# 快速登录提示文字 #}
</small>
{% for icon,url in apps %}
<a href="{{ url }}" rel="nofollow">
<span class="icon-sn-{{ icon }}"></span>
{% for icon,url in apps %} {# 遍历OAuth应用 #}
<a href="{{ url }}" rel="nofollow"> {# OAuth登录链接 #}
<span class="icon-sn-{{ icon }}"></span> {# 社交网络图标 #}
</a>
{% endfor %}
{% endif %}
</div>
</div>

@ -1,33 +1,33 @@
{% extends 'share_layout/base_account.html' %}
{% extends 'share_layout/base_account.html' %} {# 继承账户基础布局模板 #}
{% load static %}
{% block content %}
<div class="container">
{% load static %} {# 加载静态文件标签 #}
{% block content %} {# 主要内容块 #}
<div class="container"> {# 容器 #}
<h2 class="form-signin-heading text-center">绑定您的邮箱账号</h2>
<h2 class="form-signin-heading text-center">绑定您的邮箱账号</h2> {# 页面标题 #}
<div class="card card-signin">
{% if picture %}
<img class="img-circle profile-img" src="{{ picture }}" alt="">
{% else %}
<img class="img-circle profile-img" src="{% static 'blog/img/avatar.png' %}" alt="">
<div class="card card-signin"> {# 登录卡片 #}
{% if picture %} {# 如果存在用户头像 #}
<img class="img-circle profile-img" src="{{ picture }}" alt=""> {# 显示用户头像 #}
{% else %} {# 如果没有用户头像 #}
<img class="img-circle profile-img" src="{% static 'blog/img/avatar.png' %}" alt=""> {# 显示默认头像 #}
{% endif %}
<form class="form-signin" action="" method="post">
{% csrf_token %}
{% comment %}<label for="inputEmail" class="sr-only">Email address</label>
<form class="form-signin" action="" method="post"> {# 绑定邮箱表单 #}
{% csrf_token %} {# CSRF令牌 #}
{% comment %}<label for="inputEmail" class="sr-only">Email address</label> {# 注释掉的邮箱输入框 #}
<input type="email" id="inputEmail" class="form-control" placeholder="Email" required autofocus>
<label for="inputPassword" class="sr-only">Password</label>
<input type="password" id="inputPassword" class="form-control" placeholder="Password" required>{% endcomment %}
{{ form.non_field_errors }}
{% for field in form %}
{{ field }}
{{ field.errors }}
{{ form.non_field_errors }} {# 表单非字段错误 #}
{% for field in form %} {# 遍历表单字段 #}
{{ field }} {# 显示表单字段 #}
{{ field.errors }} {# 显示字段错误 #}
{% endfor %}
<button class="btn btn-lg btn-primary btn-block" type="submit">提交</button>
<button class="btn btn-lg btn-primary btn-block" type="submit">提交</button> {# 提交按钮 #}
{% comment %}
{% comment %} {# 注释掉的复选框代码 #}
<div class="checkbox">
<a class="pull-right">Need help?</a>
<label>
@ -39,8 +39,8 @@
</div>
<p class="text-center">
<a href="{% url "account:login" %}">登录</a>
<a href="{% url "account:login" %}">登录</a> {# 登录页面链接 #}
</p>
</div> <!-- /container -->
{% endblock %}
{% endblock %}

@ -1,15 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>记录日期</title>
<meta charset="UTF-8"> {# 设置字符编码为UTF-8 #}
<title>记录日期</title> {# 页面标题 #}
</head>
<body>
<ul>
{% for date in results %}
<li>
<a href="{% url 'owntracks:show_maps' %}?date={{ date }}" target="_blank">{{ date }}</a>
<ul> {# 无序列表 #}
{% for date in results %} {# 遍历日期结果 #}
<li> {# 列表项 #}
<a href="{% url 'owntracks:show_maps' %}?date={{ date }}" target="_blank">{{ date }}</a> {# 日期链接,新窗口打开地图页面 #}
</li>
{% endfor %}
</ul>

@ -1,8 +1,8 @@
<!doctype html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<meta charset="utf-8"> {# 设置字符编码 #}
<meta http-equiv="X-UA-Compatible" content="chrome=1"> {# 兼容IE浏览器 #}
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width"> {# 移动端视口设置 #}
<style>
html,
body,
@ -10,7 +10,7 @@
width: 100%;
height: 100%;
margin: 0px;
}
} {# 设置全屏地图容器样式 #}
#loadingTip {
position: absolute;
@ -21,62 +21,62 @@
background: red;
color: #fff;
font-size: 14px;
}
} {# 加载提示样式 #}
</style>
<title>运动轨迹</title>
<title>运动轨迹</title> {# 页面标题 #}
</head>
<body>
<div id="container"></div>
<script type="text/javascript" src='//webapi.amap.com/maps?v=1.4.4&key=9c89950bdfbcecd46f814309384655cd'></script>
<div id="container"></div> {# 地图容器 #}
<script type="text/javascript" src='//webapi.amap.com/maps?v=1.4.4&key=9c89950bdfbcecd46f814309384655cd'></script> {# 高德地图API #}
<!-- UI组件库 1.0 -->
<script src="//webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script>
<script src="//webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script> {# 高德地图UI组件 #}
<script type="text/javascript">
//创建地图
//创建地图 {# 初始化地图 #}
var map = new AMap.Map('container', {
zoom: 4
zoom: 4 {# 初始缩放级别 #}
});
AMapUI.load(['ui/misc/PathSimplifier', 'lib/$'], function (PathSimplifier, $) {
AMapUI.load(['ui/misc/PathSimplifier', 'lib/$'], function (PathSimplifier, $) { {# 加载路径简化和jQuery库 #}
if (!PathSimplifier.supportCanvas) {
if (!PathSimplifier.supportCanvas) { {# 检查Canvas支持 #}
alert('当前环境不支持 Canvas');
return;
}
//just some colors
//just some colors {# 定义颜色数组 #}
var colors = [
"#3366cc", "#dc3912", "#ff9900", "#109618", "#990099", "#0099c6", "#dd4477", "#66aa00",
"#b82e2e", "#316395", "#994499", "#22aa99", "#aaaa11", "#6633cc", "#e67300", "#8b0707",
"#651067", "#329262", "#5574a6", "#3b3eac"
];
var pathSimplifierIns = new PathSimplifier({
var pathSimplifierIns = new PathSimplifier({ {# 创建路径简化实例 #}
zIndex: 100,
//autoSetFitView:false,
map: map, //所属的地图实例
getPath: function (pathData, pathIndex) {
getPath: function (pathData, pathIndex) { {# 获取路径数据 #}
return pathData.path;
},
getHoverTitle: function (pathData, pathIndex, pointIndex) {
getHoverTitle: function (pathData, pathIndex, pointIndex) { {# 获取悬停标题 #}
if (pointIndex >= 0) {
//point
return pathData.name + ',点:' + pointIndex + '/' + pathData.path.length;
return pathData.name + ',点:' + pointIndex + '/' + pathData.path.length; {# 显示点信息 #}
}
return pathData.name + ',点数量' + pathData.path.length;
return pathData.name + ',点数量' + pathData.path.length; {# 显示路径点数量 #}
},
renderOptions: {
renderOptions: { {# 渲染选项 #}
pathLineStyle: {
dirArrowStyle: true
dirArrowStyle: true {# 方向箭头样式 #}
},
getPathStyle: function (pathItem, zoom) {
getPathStyle: function (pathItem, zoom) { {# 获取路径样式 #}
var color = colors[pathItem.pathIndex % colors.length],
lineWidth = Math.round(4 * Math.pow(1.1, zoom - 3));
var color = colors[pathItem.pathIndex % colors.length], {# 循环使用颜色 #}
lineWidth = Math.round(4 * Math.pow(1.1, zoom - 3)); {# 根据缩放级别计算线宽 #}
return {
pathLineStyle: {
@ -84,46 +84,46 @@
lineWidth: lineWidth
},
pathLineSelectedStyle: {
lineWidth: lineWidth + 2
lineWidth: lineWidth + 2 {# 选中状态线宽 #}
},
pathNavigatorStyle: {
fillStyle: color
fillStyle: color {# 导航点填充颜色 #}
}
};
}
}
});
window.pathSimplifierIns = pathSimplifierIns;
window.pathSimplifierIns = pathSimplifierIns; {# 将实例挂载到全局窗口对象 #}
$('<div id="loadingTip">加载数据,请稍候...</div>').appendTo(document.body);
$('<div id="loadingTip">加载数据,请稍候...</div>').appendTo(document.body); {# 添加加载提示 #}
$.getJSON('/owntracks/get_datas?date={{ date }}', function (d) {
$.getJSON('/owntracks/get_datas?date={{ date }}', function (d) { {# 获取轨迹数据 #}
if (!d || !d.length) {
$("#loadingTip").text("没有数据...")
$("#loadingTip").text("没有数据...") {# 无数据提示 #}
return;
}
$('#loadingTip').remove();
pathSimplifierIns.setData(d);
$('#loadingTip').remove(); {# 移除加载提示 #}
pathSimplifierIns.setData(d); {# 设置路径数据 #}
//initRoutesContainer(d);
function onload() {
pathSimplifierIns.renderLater();
pathSimplifierIns.renderLater(); {# 延迟渲染 #}
}
function onerror(e) {
alert('图片加载失败!');
alert('图片加载失败!'); {# 错误处理 #}
}
d.forEach(function (item, index) {
d.forEach(function (item, index) { {# 遍历数据创建路径导航 #}
var navg1 = pathSimplifierIns.createPathNavigator(index, {
loop: true,
speed: 1000,
loop: true, {# 循环播放 #}
speed: 1000, {# 播放速度 #}
});
navg1.start();
navg1.start(); {# 开始播放轨迹 #}
})
});

@ -1,3 +1,3 @@
{{ object.title }}
{{ object.author.username }}
{{ object.body }}
{{ object.title }} {# 显示对象标题 #}
{{ object.author.username }} {# 显示作者用户名 #}
{{ object.body }} {# 显示对象内容 #}

@ -1,57 +1,57 @@
{% extends 'share_layout/base.html' %}
{% load blog_tags %}
{% block header %}
<title>{{ SITE_NAME }} | {{ SITE_DESCRIPTION }}</title>
<meta name="description" content="{{ SITE_SEO_DESCRIPTION }}"/>
<meta name="keywords" content="{{ SITE_KEYWORDS }}"/>
<meta property="og:type" content="blog"/>
<meta property="og:title" content="{{ SITE_NAME }}"/>
<meta property="og:description" content="{{ SITE_DESCRIPTION }}"/>
<meta property="og:url" content="{{ SITE_BASE_URL }}"/>
<meta property="og:site_name" content="{{ SITE_NAME }}"/>
{% extends 'share_layout/base.html' %} {# 继承基础布局模板 #}
{% load blog_tags %} {# 加载博客自定义标签 #}
{% block header %} {# 头部内容块 #}
<title>{{ SITE_NAME }} | {{ SITE_DESCRIPTION }}</title> {# 页面标题 #}
<meta name="description" content="{{ SITE_SEO_DESCRIPTION }}"/> {# 页面描述 #}
<meta name="keywords" content="{{ SITE_KEYWORDS }}"/> {# 页面关键词 #}
<meta property="og:type" content="blog"/> {# OpenGraph类型 #}
<meta property="og:title" content="{{ SITE_NAME }}"/> {# OpenGraph标题 #}
<meta property="og:description" content="{{ SITE_DESCRIPTION }}"/> {# OpenGraph描述 #}
<meta property="og:url" content="{{ SITE_BASE_URL }}"/> {# OpenGraph网址 #}
<meta property="og:site_name" content="{{ SITE_NAME }}"/> {# OpenGraph站点名称 #}
{% endblock %}
{% block content %}
<div id="primary" class="site-content">
<div id="content" role="main">
{% if query %}
<header class="archive-header">
{% if suggestion %}
{% block content %} {# 主要内容块 #}
<div id="primary" class="site-content"> {# 主要内容区域 #}
<div id="content" role="main"> {# 内容区域 #}
{% if query %} {# 如果存在搜索查询 #}
<header class="archive-header"> {# 归档页眉 #}
{% if suggestion %} {# 如果有搜索建议 #}
<h2 class="archive-title">
已显示<span style="color: red"> “{{ suggestion }}” </span>的搜索结果。&nbsp;&nbsp;
仍然搜索:<a style="text-transform: none;" href="/search/?q={{ query }}&is_suggest=no">{{ query }}</a> <br>
已显示<span style="color: red"> “{{ suggestion }}” </span>的搜索结果。&nbsp;&nbsp; {# 显示建议词 #}
仍然搜索:<a style="text-transform: none;" href="/search/?q={{ query }}&is_suggest=no">{{ query }}</a> <br> {# 原始查询链接 #}
</h2>
{% else %}
{% else %} {# 如果没有搜索建议 #}
<h2 class="archive-title">
搜索:<span style="color: red">{{ query }} </span> &nbsp;&nbsp;
搜索:<span style="color: red">{{ query }} </span> &nbsp;&nbsp; {# 显示搜索词 #}
</h2>
{% endif %}
</header><!-- .archive-header -->
{% endif %}
{% if query and page.object_list %}
{% for article in page.object_list %}
{% load_article_detail article.object True user %}
{% if query and page.object_list %} {# 如果有查询结果 #}
{% for article in page.object_list %} {# 遍历搜索结果 #}
{% load_article_detail article.object True user %} {# 加载文章详情 #}
{% endfor %}
{% if page.has_previous or page.has_next %}
<nav id="nav-below" class="navigation" role="navigation">
<h3 class="assistive-text">文章导航</h3>
{% if page.has_previous %}
{% if page.has_previous or page.has_next %} {# 如果存在分页 #}
<nav id="nav-below" class="navigation" role="navigation"> {# 分页导航 #}
<h3 class="assistive-text">文章导航</h3> {# 辅助文本 #}
{% if page.has_previous %} {# 如果有上一页 #}
<div class="nav-previous"><a
href="?q={{ query }}&amp;page={{ page.previous_page_number }}"><span
class="meta-nav">&larr;</span> 早期文章</a></div>
class="meta-nav">&larr;</span> 早期文章</a></div> {# 上一页链接 #}
{% endif %}
{% if page.has_next %}
{% if page.has_next %} {# 如果有下一页 #}
<div class="nav-next"><a href="?q={{ query }}&amp;page={{ page.next_page_number }}">较新文章
<span
class="meta-nav">→</span></a>
class="meta-nav">→</span></a> {# 下一页链接 #}
</div>
{% endif %}
</nav><!-- .navigation -->
{% endif %}
{% else %}
{% else %} {# 如果没有搜索结果 #}
<header class="archive-header">
<h1 class="archive-title">哎呀,关键字:<span>{{ query }}</span>没有找到结果,要不换个词再试试?</h1>
<h1 class="archive-title">哎呀,关键字:<span>{{ query }}</span>没有找到结果,要不换个词再试试?</h1> {# 无结果提示 #}
</header><!-- .archive-header -->
{% endif %}
</div><!-- #content -->
@ -59,8 +59,6 @@
{% endblock %}
{% block sidebar %}
{% load_sidebar request.user 'i' %}
{% endblock %}
{% block sidebar %} {# 侧边栏块 #}
{% load_sidebar request.user 'i' %} {# 加载侧边栏内容 #}
{% endblock %}

@ -1,6 +1,6 @@
<aside id="text-2" class="widget widget_text"><h3 class="widget-title">Google AdSense</h3>
<aside id="text-2" class="widget widget_text"><h3 class="widget-title">Google AdSense</h3> {# Google广告侧边栏部件 #}
<div class="textwidget">
{{ GOOGLE_ADSENSE_CODES }}
{{ GOOGLE_ADSENSE_CODES }} {# Google AdSense广告代码变量 #}
</div>
</aside>
</aside>

@ -1,75 +1,75 @@
{% load static %}
{% load cache %}
{% load i18n %}
{% load compress %}
<!DOCTYPE html>
<!--[if IE 7]>
{% load static %} {# 加载静态文件标签 #}
{% load cache %} {# 加载缓存标签 #}
{% load i18n %} {# 加载国际化标签 #}
{% load compress %} {# 加载压缩标签 #}
<!DOCTYPE html> {# HTML5文档类型声明 #}
<!--[if IE 7]> {# IE7条件注释 #}
<html class="ie ie7" lang="zh-CN"
prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/article#">
<![endif]-->
<!--[if IE 8]>
<!--[if IE 8]> {# IE8条件注释 #}
<html class="ie ie8" lang="zh-CN"
prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/article#">
<![endif]-->
<!--[if !(IE 7) & !(IE 8)]><!-->
<html lang="zh-CN" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/article#">
<!--[if !(IE 7) & !(IE 8)]><!--> {# 非IE7和IE8浏览器 #}
<html lang="zh-CN" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/article#"> {# OpenGraph协议 #}
<!--<![endif]-->
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width"/>
{% block header %}
<title>{% block title %}{{ SITE_NAME }}{% endblock %}</title>
<meta name="description" content="{{ SITE_DESCRIPTION }}">
<meta name="keywords" content="{{ SITE_KEYWORDS }}">
<meta charset="UTF-8"/> {# 字符编码 #}
<meta name="viewport" content="width=device-width"/> {# 响应式视口设置 #}
{% block header %} {# 头部内容块 #}
<title>{% block title %}{{ SITE_NAME }}{% endblock %}</title> {# 页面标题 #}
<meta name="description" content="{{ SITE_DESCRIPTION }}"> {# 页面描述 #}
<meta name="keywords" content="{{ SITE_KEYWORDS }}"> {# 页面关键词 #}
{% endblock %}
{% load blog_tags %}
{% head_meta %}
<link rel="profile" href="http://gmpg.org/xfn/11"/>
{% load blog_tags %} {# 加载博客自定义标签 #}
{% head_meta %} {# 头部元数据标签 #}
<link rel="profile" href="http://gmpg.org/xfn/11"/> {# 微格式协议 #}
<!--[if lt IE 9]>
<script src="{% static 'blog/js/html5.js' %}" type="text/javascript"></script>
<!--[if lt IE 9]> {# IE9以下浏览器条件注释 #}
<script src="{% static 'blog/js/html5.js' %}" type="text/javascript"></script> {# HTML5兼容脚本 #}
<![endif]-->
<link rel="alternate" type="application/rss+xml" title="{{ SITE_NAME }} &raquo; Feed"
href="/feed"/>
href="/feed"/> {# RSS订阅链接 #}
<link rel='stylesheet preload' as="font" id='twentytwelve-fonts-css'
href='{% static 'blog/fonts/fonts.css' %}'
href='{% static 'blog/fonts/fonts.css' %}' {# 字体样式表 #}
type='text/css' media='all'/>
<link rel="dns-prefetch" href="//cdn.mathjax.org"/>
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
<link rel="icon" href="/favicon.ico" type="image/x-icon"/>
<link rel="apple-touch-icon" href="/favicon.ico"/>
{% compress css %}
<link rel="dns-prefetch" href="//cdn.mathjax.org"/> {# MathJax CDN预连接 #}
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/> {# 网站图标 #}
<link rel="icon" href="/favicon.ico" type="image/x-icon"/> {# 网站图标 #}
<link rel="apple-touch-icon" href="/favicon.ico"/> {# Apple触摸图标 #}
{% compress css %} {# CSS压缩块 #}
<link rel='stylesheet' id='twentytwelve-style-css' href='{% static 'blog/css/style.css' %}' type='text/css'
media='all'/>
<link href="{% static 'blog/css/oauth_style.css' %}" rel="stylesheet">
{% comment %}<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>{% endcomment %}
<!--[if lt IE 9]>
<link rel='stylesheet' id='twentytwelve-ie-css' href='{% static 'blog/css/ie.css' %}' type='text/css' media='all' />
media='all'/> {# 主样式表 #}
<link href="{% static 'blog/css/oauth_style.css' %}" rel="stylesheet"> {# OAuth样式表 #}
{% comment %}<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>{% endcomment %} {# 注释掉的代码高亮脚本 #}
<!--[if lt IE 9]> {# IE9以下浏览器条件注释 #}
<link rel='stylesheet' id='twentytwelve-ie-css' href='{% static 'blog/css/ie.css' %}' type='text/css' media='all' /> {# IE兼容样式表 #}
<![endif]-->
<link rel="stylesheet" href="{% static 'pygments/default.css' %}"/>
<link rel="stylesheet" href="{% static 'blog/css/nprogress.css' %}">
{% block compress_css %}
<link rel="stylesheet" href="{% static 'pygments/default.css' %}"/> {# 代码高亮样式表 #}
<link rel="stylesheet" href="{% static 'blog/css/nprogress.css' %}"> {# 进度条样式表 #}
{% block compress_css %} {# 可扩展的CSS块 #}
{% endblock %}
{% endcompress %}
{% if GLOBAL_HEADER %}
{{ GLOBAL_HEADER|safe }}
{% if GLOBAL_HEADER %} {# 全局头部代码 #}
{{ GLOBAL_HEADER | safe }} {# 安全渲染全局头部代码 #}
{% endif %}
</head>
<body class="home blog custom-font-enabled">
<div id="page" class="hfeed site">
<header id="masthead" class="site-header" role="banner">
<hgroup>
<h1 class="site-title"><a href="/" title="{{ SITE_NAME }}" rel="home">{{ SITE_NAME }}</a>
<body class="home blog custom-font-enabled"> {# 页面主体包含CSS类 #}
<div id="page" class="hfeed site"> {# 页面容器 #}
<header id="masthead" class="site-header" role="banner"> {# 网站头部 #}
<hgroup> {# 标题组 #}
<h1 class="site-title"><a href="/" title="{{ SITE_NAME }}" rel="home">{{ SITE_NAME }}</a> {# 网站标题链接 #}
</h1>
<h2 class="site-description">{{ SITE_DESCRIPTION }}</h2>
<h2 class="site-description">{{ SITE_DESCRIPTION }}</h2> {# 网站描述 #}
</hgroup>
{% load i18n %}
{% load i18n %} {# 加载国际化标签 #}
{# <div class="i18n-selector">#}
{# <div class="i18n-selector"> {# 注释掉的语言选择器 #}
{# <form action="{% url 'set_language' %}" method="post" id="i18n-form">{% csrf_token %}#}
{# <input name="next" type="hidden" value="{{ redirect_to }}">#}
{# <select name="language" class="i18n-select" >#}
@ -87,37 +87,37 @@
{# </div>#}
{% include 'share_layout/nav.html' %}
{% include 'share_layout/nav.html' %} {# 包含导航模板 #}
</header><!-- #masthead -->
<div id="main" class="wrapper">
<div id="main" class="wrapper"> {# 主要内容区域 #}
{% block content %}
{% block content %} {# 主要内容块 #}
{% endblock %}
{% block sidebar %}
{% block sidebar %} {# 侧边栏块 #}
{% endblock %}
</div><!-- #main .wrapper -->
{% include 'share_layout/footer.html' %}
{% include 'share_layout/footer.html' %} {# 包含页脚模板 #}
</div><!-- #page -->
</body>
<footer>
<script src="//cdn.bootcss.com/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
{% compress js %}
<script type="text/javascript" src="{% static 'blog/js/jquery-3.6.0.min.js' %}"></script>
<script type="text/javascript" src="{% static 'blog/js/nprogress.js' %}"></script>
<script src="{% static 'blog/js/blog.js' %}" type="application/javascript"></script>
<script src="{% static 'blog/js/navigation.js' %}" type="application/javascript"></script>
<script src="{% static 'mathjax/js/mathjax-config.js' %}" type="application/javascript"></script>
{% block compress_js %}
<footer> {# 页脚脚本区域 #}
<script src="//cdn.bootcss.com/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> {# MathJax数学公式渲染 #}
{% compress js %} {# JavaScript压缩块 #}
<script type="text/javascript" src="{% static 'blog/js/jquery-3.6.0.min.js' %}"></script> {# jQuery库 #}
<script type="text/javascript" src="{% static 'blog/js/nprogress.js' %}"></script> {# 进度条脚本 #}
<script src="{% static 'blog/js/blog.js' %}" type="application/javascript"></script> {# 博客自定义脚本 #}
<script src="{% static 'blog/js/navigation.js' %}" type="application/javascript"></script> {# 导航脚本 #}
<script src="{% static 'mathjax/js/mathjax-config.js' %}" type="application/javascript"></script> {# MathJax配置脚本 #}
{% block compress_js %} {# 可扩展的JavaScript块 #}
{% endblock %}
{% endcompress %}
{% block footer %}
{% block footer %} {# 页脚内容块 #}
{% endblock %}
</footer>
</html>
</html>

@ -1,47 +1,47 @@
<!DOCTYPE html>
<html>
<head>
{% load static %}
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<meta name="robots" content="noindex">
<title>{{ SITE_NAME }} | {{ SITE_DESCRIPTION }}</title>
<link href="{% static 'account/css/account.css' %}" rel="stylesheet">
{% load compress %}
{% compress css %}
<!-- Bootstrap core CSS -->
{% load static %} {# 加载静态文件标签 #}
<meta charset="utf-8"> {# 字符编码 #}
<meta http-equiv="X-UA-Compatible" content="IE=edge"> {# IE浏览器兼容模式 #}
<meta name="viewport" content="width=device-width, initial-scale=1"> {# 响应式视口设置 #}
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> {# 必须放在头部的三个meta标签 #}
<meta name="description" content=""> {# 页面描述 #}
<meta name="author" content=""> {# 页面作者 #}
<link rel="icon" href="../../favicon.ico"> {# 网站图标 #}
<meta name="robots" content="noindex"> {# 禁止搜索引擎索引 #}
<title>{{ SITE_NAME }} | {{ SITE_DESCRIPTION }}</title> {# 页面标题 #}
<link href="{% static 'account/css/account.css' %}" rel="stylesheet"> {# 账户页面样式表 #}
{% load compress %} {# 加载压缩标签 #}
{% compress css %} {# CSS压缩块 #}
<!-- Bootstrap core CSS --> {# Bootstrap核心样式 #}
<link href="{% static 'assets/css/bootstrap.min.css' %}" rel="stylesheet">
<link href="{% static 'blog/css/oauth_style.css' %}" rel="stylesheet">
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<link href="{% static 'blog/css/oauth_style.css' %}" rel="stylesheet"> {# OAuth样式表 #}
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> {# IE10视口修复 #}
<link href="{% static 'assets/css/ie10-viewport-bug-workaround.css' %}" rel="stylesheet">
<!-- TODC Bootstrap core CSS -->
<!-- TODC Bootstrap core CSS --> {# TODC Bootstrap样式 #}
<link href="{% static 'assets/css/todc-bootstrap.min.css' %}" rel="stylesheet">
<!-- Custom styles for this template -->
<!-- Custom styles for this template --> {# 自定义样式 #}
<link href="{% static 'assets/css/signin.css' %}" rel="stylesheet">
{% endcompress %}
{% compress js %}
<script src="{% static 'assets/js/ie10-viewport-bug-workaround.js' %}"></script>
<script src="{% static 'assets/js/ie-emulation-modes-warning.js' %}"></script>
{% compress js %} {# JavaScript压缩块 #}
<script src="{% static 'assets/js/ie10-viewport-bug-workaround.js' %}"></script> {# IE10视口修复脚本 #}
<script src="{% static 'assets/js/ie-emulation-modes-warning.js' %}"></script> {# IE模拟模式警告脚本 #}
{% endcompress %}
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> {# HTML5兼容性支持 #}
<!--[if lt IE 9]> {# IE9以下浏览器条件注释 #}
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> {# HTML5标签支持 #}
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> {# 媒体查询支持 #}
<![endif]-->
</head>
<body>
{% block content %}
{% block content %} {# 主要内容块 #}
{% endblock %}
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> {# IE10视口修复注释 #}
</body>
<script type="text/javascript" src="{% static 'blog/js/jquery-3.6.0.min.js' %}"></script>
<script src="{% static 'account/js/account.js' %}" type="text/javascript"></script>
<script type="text/javascript" src="{% static 'blog/js/jquery-3.6.0.min.js' %}"></script> {# jQuery库 #}
<script src="{% static 'account/js/account.js' %}" type="text/javascript"></script> {# 账户页面脚本 #}
</html>

@ -1,56 +1,54 @@
<footer id="colophon" role="contentinfo">
<div class="site-info" style="text-align: center">
Copyright&copy;&nbsp;{{ CURRENT_YEAR }}&nbsp;
<a href="/" target="blank">{{ SITE_NAME }}</a>
<footer id="colophon" role="contentinfo"> {# 页脚区域 #}
<div class="site-info" style="text-align: center"> {# 网站信息,居中对齐 #}
Copyright&copy;&nbsp;{{ CURRENT_YEAR }}&nbsp; {# 版权信息和当前年份 #}
<a href="/" target="blank">{{ SITE_NAME }}</a> {# 网站首页链接 #}
&nbsp;|&nbsp;
<a href="/sitemap.xml" title="SiteMap" target="_blank">
<a href="/sitemap.xml" title="SiteMap" target="_blank"> {# 网站地图链接 #}
SiteMap
</a>
&nbsp;|&nbsp;
<a href="/feed" title="RSS Feed" target="_blank">
<a href="/feed" title="RSS Feed" target="_blank"> {# RSS订阅链接 #}
RSS Feed
</a>
&nbsp;|&nbsp;
<a href="/links.html" title="友情链接" rel="nofollow" target="_blank">
<a href="/links.html" title="友情链接" rel="nofollow" target="_blank"> {# 友情链接页面 #}
友情链接
</a>
|&nbsp; Hosting On&nbsp;
<a href="https://www.linode.com/?r=b0d38794d05ef8816b357a929106e89b7c6452f9" target="blank" rel="nofollow">Linode</a>
|&nbsp; Hosting On&nbsp; {# 托管服务商信息 #}
<a href="https://www.linode.com/?r=b0d38794d05ef8816b357a929106e89b7c6452f9" target="blank" rel="nofollow">Linode</a> {# Linode托管链接 #}
|&nbsp;
<a href="https://tongji.baidu.com/sc-web/3478620/home/ico?siteId=11261596" target="_blank"
rel="nofollow">百度统计</a>
rel="nofollow">百度统计</a> {# 百度统计链接 #}
</div>
<div class="site-info" style="text-align: center">
Powered by
<a href="https://www.djangoproject.com/" rel="nofollow" target="blank">Django</a>
<div class="site-info" style="text-align: center"> {# 技术支持信息 #}
Powered by {# 技术支持 #}
<a href="https://www.djangoproject.com/" rel="nofollow" target="blank">Django</a> {# Django框架链接 #}
&nbsp;|&nbsp;
<a href="https://github.com/liangliangyy/DjangoBlog" rel="nofollow" target="blank">liangliangyy</a>
<a href="https://github.com/liangliangyy/DjangoBlog" rel="nofollow" target="blank">liangliangyy</a> {# 项目GitHub链接 #}
|
<a href="https://www.lylinux.net" target="blank">lylinux</a>
<a href="https://www.lylinux.net" target="blank">lylinux</a> {# 作者网站链接 #}
|
本页面加载耗时:<!!LOAD_TIMES!!>s
本页面加载耗时:<!!LOAD_TIMES!!>s {# 页面加载时间占位符 #}
</div>
{% if BEIAN_CODE %}
<div class="site-info" style="text-align: center">
<a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">
{% if BEIAN_CODE %} {# 如果存在备案号 #}
<div class="site-info" style="text-align: center"> {# 备案信息 #}
<a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank"> {# 工信部备案查询链接 #}
<p style=" height:20px;line-height:20px;margin: 0px 0px 0px 5px; color:#939393;">
{{ BEIAN_CODE }}
{{ BEIAN_CODE }} {# 备案号显示 #}
</p>
</a>
{% if BEIAN_CODE_GONGAN and SHOW_GONGAN_CODE %}
{{ BEIAN_CODE_GONGAN |safe }}
{% if BEIAN_CODE_GONGAN and SHOW_GONGAN_CODE %} {# 如果存在公安备案号且允许显示 #}
{{ BEIAN_CODE_GONGAN | safe }} {# 安全渲染公安备案代码 #}
{% endif %}
</div>
{% endif %}
{% if ANALYTICS_CODE %}
{{ ANALYTICS_CODE| safe }}
{% if ANALYTICS_CODE %} {# 如果存在统计代码 #}
{{ ANALYTICS_CODE|safe }} {# 安全渲染统计代码 #}
{% endif %}
{% if GLOBAL_FOOTER %}
{{ GLOBAL_FOOTER|safe }}
{% if GLOBAL_FOOTER %} {# 如果存在全局页脚代码 #}
{{ GLOBAL_FOOTER|safe }} {# 安全渲染全局页脚代码 #}
{% endif %}
</footer><!-- #colophon -->
</footer><!-- #colophon --> {# 页脚结束 #}

@ -1,30 +1,30 @@
{% load i18n %}
{% load i18n %} {# 加载国际化标签 #}
<nav id="site-navigation" class="main-navigation" role="navigation">
<div class="menu-%e8%8f%9c%e5%8d%95-container">
<ul id="menu-%e8%8f%9c%e5%8d%95" class="nav-menu">
<nav id="site-navigation" class="main-navigation" role="navigation"> {# 主导航区域 #}
<div class="menu-%e8%8f%9c%e5%8d%95-container"> {# 菜单容器URL编码的"菜单" #}
<ul id="menu-%e8%8f%9c%e5%8d%95" class="nav-menu"> {# 导航菜单列表 #}
<li id="menu-item-3498"
class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item menu-item-home menu-item-3498">
<a href="/">{% trans 'index' %}</a></li>
class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item menu-item-home menu-item-3498"> {# 首页菜单项 #}
<a href="/">{% trans 'index' %}</a></li> {# 首页链接 #}
{% load blog_tags %}
{% query nav_category_list parent_category=None as root_categorys %}
{% for node in root_categorys %}
{% include 'share_layout/nav_node.html' %}
{% load blog_tags %} {# 加载博客自定义标签 #}
{% query nav_category_list parent_category=None as root_categorys %} {# 查询根分类 #}
{% for node in root_categorys %} {# 遍历根分类 #}
{% include 'share_layout/nav_node.html' %} {# 包含导航节点模板 #}
{% endfor %}
{% if nav_pages %}
{% for node in nav_pages %}
{% if nav_pages %} {# 如果存在导航页面 #}
{% for node in nav_pages %} {# 遍历导航页面 #}
<li id="menu-item-{{ node.pk }}"
<li id="menu-item-{{ node.pk }}" {# #}
class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-{{ node.pk }}">
<a href="{{ node.get_absolute_url }}">{{ node.title }}</a>
<a href="{{ node.get_absolute_url }}">{{ node.title }}</a> {# 页面链接 #}
</li>
{% endfor %}
{% endif %}
<li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children"> {# 文章归档菜单项 #}
<a href="{% url "blog:archives" %}">{% trans 'Article archive' %}</a>
<a href="{% url "blog:archives" %}">{% trans 'Article archive' %}</a> {# 文章归档链接 #}
</li>
</ul>
</div>
</nav><!-- #site-navigation -->
</nav><!-- #site-navigation --> {# 站点导航结束 #}

@ -1,19 +1,17 @@
<li id="menu-item-{{ node.pk }}"
class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-{{ node.pk }}">
<a href="{{ node.get_absolute_url }}">{{ node.name }}</a>
{% load blog_tags %}
{% query nav_category_list parent_category=node as child_categorys %}
{% if child_categorys %}
<li id="menu-item-{{ node.pk }}" {# ID #}
class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-{{ node.pk }}"> {# 菜单项CSS类 #}
<a href="{{ node.get_absolute_url }}">{{ node.name }}</a> {# 分类链接和名称 #}
{% load blog_tags %} {# 加载博客自定义标签 #}
{% query nav_category_list parent_category=node as child_categorys %} {# 查询子分类 #}
{% if child_categorys %} {# 如果存在子分类 #}
<ul class="sub-menu">
{% for child in child_categorys %}
{% with node=child template_name="share_layout/nav_node.html" %}
{% include template_name %}
<ul class="sub-menu"> {# 子菜单列表 #}
{% for child in child_categorys %} {# 遍历子分类 #}
{% with node=child template_name="share_layout/nav_node.html" %} {# 传递变量到子模板 #}
{% include template_name %} {# 递归包含导航节点模板 #}
{% endwith %}
{% endfor %}
</ul>
{% endif %}
</li>
</li>

@ -1 +1,2 @@
print('hello world')
# This is the main Python file

Loading…
Cancel
Save