blog/themes/cmd/layout/index.njk
2022-02-12 23:19:50 +08:00

50 lines
1.4 KiB
Text

{% extends 'includes/layout.njk' %}
{% from "includes/postlist.njk" import PostList with context %}
{% import "includes/cards.njk" as cards with context %}
{% macro HomePaginiation() %}
<ul class="pagination center">
{% for n in range(1, page.total+1, 1) %}
<li class="{{ 'active' if page.current == n else 'waves-effect' }}">
<a href="{{ url_for('page/'+n+'/') if n != 1 else url_for('') }}">{{ n }}</a>
</li>
{% endfor %}
</ul>
{% endmacro %}
{% macro TagPanel(tags) %}
<div class="card-panel" style="padding-top: 12px; padding-bottom: 12px;">
<span class="chip transparent">Tags</span>
{% for tag in tags %}
<a href="{{ url_for(tag.path) }}">
<div class="chip">
{{ tag.name }}
</div>
</a>
{% endfor %}
</div>
{% endmacro %}
{% block body %}
<div class="row">
<div class="col m8 l9">
{% if page.current == 1 %}
{{ cards.Me(config.author, config.email, config.description) }}
{% endif %}
{% if page.posts.length > 0 %}
{{ PostList(page.posts.toArray()) }}
{% else %}
<span>No Posts Here...</span>
{% endif %}
<div class="center">
{{ HomePaginiation() }}
</div>
</div>
<div class="col m4 l3 hide-on-small-only">
{{ TagPanel(site.tags.data) }}
</div>
</div>
{% endblock %}
{% block add_head %}
<link rel="stylesheet" href="/css/index.css"/>
{% endblock %}