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

83 lines
4.0 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{% load blog_tags %}
{% load cache %}
{% load i18n %}
<!-- 文章主体容器包含唯一ID和样式类 -->
<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 article.article_order > 0 %} <!-- 若文章有置顶权重大于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' %} <!-- 显示评论数量 -->
{% else %}
{% trans 'comment' %} <!-- 显示"评论"文本 -->
{% endif %}
</span>
</a>
{% endif %}
<!-- 右侧显示文章阅读量 -->
<div style="float:right">
{{ article.views }} views
</div>
</div><!-- .comments-link -->
<br/>
{% if article.type == 'a' %} <!-- 若文章类型为普通文章(假设'a'代表文章) -->
{% if not isindex %} <!-- 非列表页时显示面包屑导航 -->
<!-- 缓存面包屑导航10小时36000秒以文章ID作为缓存键 -->
{% cache 36000 breadcrumb article.pk %}
{% load_breadcrumb article %} <!-- 调用自定义标签生成面包屑 -->
{% endcache %}
{% endif %}
{% endif %}
</header><!-- .entry-header -->
<div class="entry-content" itemprop="articleBody"> <!-- 文章内容区域,标记为文章主体 -->
{% if isindex %} <!-- 列表页显示 -->
<!-- 显示经过自定义markdown处理、转义并截断的内容 -->
{{ 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 %} <!-- 若文章设置显示目录 -->
<!-- 获取markdown内容中的目录 -->
{% get_markdown_toc article.body as toc %}
<b>{% trans 'toc' %}:</b> <!-- 显示"目录"标签 -->
{{ toc|safe }} <!-- 安全渲染目录HTML -->
<hr class="break_line"/> <!-- 分隔线 -->
{% endif %}
<div class="article">
<!-- 显示完整的经过markdown处理和转义的文章内容 -->
{{ article.body|custom_markdown|escape }}
</div>
{% endif %}
</div><!-- .entry-content -->
<!-- 加载文章元数据(如作者、发布时间、分类等),调用自定义标签 -->
{% load_article_metas article user %}
</article><!-- #post -->