Files
hexo-theme-shoka/layout/page.njk
2020-09-02 21:28:24 +08:00

72 lines
2.3 KiB
Plaintext

{% extends '_partials/layout.njk' %}
{% import '_macro/sidebar.njk' as sidebar with context %}
{% import '_macro/comment.njk' as comment with context %}
{% block title %}
{%- if page.type === 'categories' %}
{{- __('title.all') + __('title.category') }}
{%- elif page.type === 'tags' %}
{{- __('title.all') + __('title.tag') }}
{%- elif page.type === '404' %}
{{- __('title.not_found') }}
{%- else %}
{{- page.title }}
{%- endif %} |
{% endblock %}
{% block header %}
<h1 itemprop="name headline">
{%- if page.link %}
{%- set postTitleIcon = '<i class="ic i-link-alt"></i>' %}
{%- set postText = page.title or page.link %}
{{ _url(page.link, postText + postTitleIcon, {class: 'link external', itemprop: 'url'}) }}
{%- else %}
{%- if page.type === 'categories' %}
{{- __('title.all') + __('title.category') }}
{%- elif page.type === 'tags' %}
{{- __('title.all') + __('title.tag') }}
{%- elif page.type === '404' %}
{{- __('title.not_found') }}
{%- else %}
{{- page.title }}
{%- endif %}
{%- endif %}
</h1>
{% endblock %}
{% block content %}
{%- if page.type === 'categories' %}
<div class="collapse wrap">
<h2 class="item title"><a href="{{ url_for(site.path) }}">{{ __('menu.home') }}</a> <small>/</small> {{ _p('counter.categories', site.categories.length) }}</h2>
{{ _list_categories(3) }}
</div>
{%- elif page.type === 'tags' %}
<div class="collapse wrap">
<h2 class="item title"><a href="{{ url_for(site.path) }}">{{ __('menu.home') }}</a> <small>/</small> {{ _p('counter.tag_cloud', site.tags.length) }}</h2>
<div class="tag cloud">
{{ tagcloud({
min_font : theme.tagcloud.min,
max_font : theme.tagcloud.max,
amount : theme.tagcloud.amount,
color : true,
start_color: theme.tagcloud.start,
end_color : theme.tagcloud.end})
}}
</div>
</div>
{%- elif page.type === '404' %}
<div class="page wrap">
<div class="notfound">{{ __('title.not_found') }}</div>
</div>
{%- else %}
<div class="page wrap">
{{ partial('_partials/post/post.njk', {post: page}) }}
</div>
{{ comment.render() }}
{%- endif %}
{% endblock %}
{% block sidebar %}
{{ sidebar.render(true) }}
{% endblock %}