forked from plhw57tbe/SoftwareMethodology
parent
c636f1f3dc
commit
244fbca94d
@ -1,74 +1,83 @@
|
||||
{% load blog_tags %}
|
||||
{% load cache %}
|
||||
{% load i18n %}
|
||||
<article id="post-{{ article.pk }} "
|
||||
class="post-{{ article.pk }} post type-post status-publish format-standard hentry">
|
||||
<header class="entry-header">
|
||||
{% load blog_tags %} {# 加载自定义博客标签 #}
|
||||
{% load cache %} {# 加载缓存标签 #}
|
||||
{% load i18n %} {# 加载国际化标签 #}
|
||||
|
||||
<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 %}
|
||||
<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>
|
||||
{% 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 }}
|
||||
{% 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">
|
||||
{% 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 %}
|
||||
{% 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
|
||||
{{ article.views }} views {# 显示浏览次数 #}
|
||||
</div>
|
||||
</div><!-- .comments-link -->
|
||||
|
||||
<br/>
|
||||
{% if article.type == 'a' %}
|
||||
{% if not isindex %}
|
||||
{% cache 36000 breadcrumb article.pk %}
|
||||
{% load_breadcrumb article %}
|
||||
|
||||
{# 面包屑导航(仅限文章详情页且不是列表页) #}
|
||||
{% if article.type == 'a' %} {# 如果是文章类型 #}
|
||||
{% if not isindex %} {# 如果不是列表页 #}
|
||||
{% cache 36000 breadcrumb article.pk %} {# 缓存10小时 #}
|
||||
{% load_breadcrumb article %} {# 加载面包屑导航 #}
|
||||
{% endcache %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</header><!-- .entry-header -->
|
||||
|
||||
|
||||
{# 文章内容 #}
|
||||
<div class="entry-content" itemprop="articleBody">
|
||||
{% if isindex %}
|
||||
{% 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 %}
|
||||
{# "阅读更多"链接 #}
|
||||
<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 }}
|
||||
|
||||
<hr class="break_line"/>
|
||||
<b>{% trans 'toc' %}:</b> {# 目录标题 #}
|
||||
{{ 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 -->
|
||||
Loading…
Reference in new issue