2019-09-30 15:38:41 +03:00
|
|
|
---
|
|
|
|
layout: page
|
|
|
|
# The Home page layout
|
|
|
|
---
|
|
|
|
|
2021-08-01 16:54:27 +03:00
|
|
|
{% include lang.html %}
|
|
|
|
|
2021-07-20 20:01:09 +03:00
|
|
|
{% assign pinned = site.posts | where: "pin", "true" %}
|
|
|
|
{% assign default = site.posts | where_exp: "item", "item.pin != true" %}
|
2020-06-06 07:45:33 +03:00
|
|
|
|
|
|
|
{% assign posts = "" | split: "" %}
|
|
|
|
|
|
|
|
<!-- Get pinned posts -->
|
|
|
|
|
|
|
|
{% assign offset = paginator.page | minus: 1 | times: paginator.per_page %}
|
|
|
|
{% assign pinned_num = pinned.size | minus: offset %}
|
|
|
|
|
|
|
|
{% if pinned_num > 0 %}
|
|
|
|
{% for i in (offset..pinned.size) limit: pinned_num %}
|
|
|
|
{% assign posts = posts | push: pinned[i] %}
|
|
|
|
{% endfor %}
|
|
|
|
{% else %}
|
|
|
|
{% assign pinned_num = 0 %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
2020-06-08 16:44:59 +03:00
|
|
|
<!-- Get default posts -->
|
2020-06-06 07:45:33 +03:00
|
|
|
|
|
|
|
{% assign default_beg = offset | minus: pinned.size %}
|
|
|
|
|
|
|
|
{% if default_beg < 0 %}
|
|
|
|
{% assign default_beg = 0 %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% assign default_num = paginator.posts | size | minus: pinned_num %}
|
|
|
|
{% assign default_end = default_beg | plus: default_num | minus: 1 %}
|
|
|
|
|
|
|
|
{% if default_num > 0 %}
|
|
|
|
{% for i in (default_beg..default_end) %}
|
|
|
|
{% assign posts = posts | push: default[i] %}
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
|
2019-09-30 15:38:41 +03:00
|
|
|
<div id="post-list">
|
2020-06-06 07:45:33 +03:00
|
|
|
|
|
|
|
{% for post in posts %}
|
|
|
|
|
2019-09-30 15:38:41 +03:00
|
|
|
<div class="post-preview">
|
2020-12-29 10:37:32 +03:00
|
|
|
<h1>
|
|
|
|
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
|
|
|
|
</h1>
|
2020-12-17 10:18:02 +03:00
|
|
|
|
2019-09-30 15:38:41 +03:00
|
|
|
<div class="post-content">
|
|
|
|
<p>
|
2020-07-22 16:41:49 +03:00
|
|
|
{% include no-linenos.html content=post.content %}
|
|
|
|
{{ content | markdownify | strip_html | truncate: 200 }}
|
2019-09-30 15:38:41 +03:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
2021-12-04 01:56:33 +03:00
|
|
|
<div class="post-meta text-muted d-flex">
|
2020-12-17 10:18:02 +03:00
|
|
|
|
2021-12-04 01:56:33 +03:00
|
|
|
<div class="mr-auto">
|
2020-12-17 10:18:02 +03:00
|
|
|
<!-- posted date -->
|
|
|
|
<i class="far fa-calendar fa-fw"></i>
|
|
|
|
{% include timeago.html date=post.date tooltip=true %}
|
|
|
|
|
|
|
|
<!-- time to read -->
|
|
|
|
<i class="far fa-clock fa-fw"></i>
|
|
|
|
{% include read-time.html content=post.content %}
|
|
|
|
|
2021-12-03 15:50:12 +03:00
|
|
|
<!-- categories -->
|
|
|
|
{% if post.categories.size > 0 %}
|
|
|
|
<i class="far fa-folder-open fa-fw"></i>
|
|
|
|
<span>
|
|
|
|
{% for category in post.categories %}
|
|
|
|
{{ category }}
|
|
|
|
{%- unless forloop.last -%},{%- endunless -%}
|
|
|
|
{% endfor %}
|
|
|
|
</span>
|
2020-12-17 10:18:02 +03:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{% if post.pin %}
|
|
|
|
<div class="pin">
|
|
|
|
<i class="fas fa-thumbtack fa-fw"></i>
|
2021-08-01 16:54:27 +03:00
|
|
|
<span>{{ site.data.locales[lang].post.pin_prompt }}</span>
|
2020-12-17 10:18:02 +03:00
|
|
|
</div>
|
2019-09-30 15:38:41 +03:00
|
|
|
{% endif %}
|
2020-12-17 10:17:21 +03:00
|
|
|
|
2020-12-17 10:18:02 +03:00
|
|
|
</div> <!-- .post-meta -->
|
|
|
|
|
2019-09-30 15:38:41 +03:00
|
|
|
</div> <!-- .post-review -->
|
2020-06-06 07:45:33 +03:00
|
|
|
|
|
|
|
{% endfor %}
|
|
|
|
|
2019-09-30 15:38:41 +03:00
|
|
|
</div> <!-- #post-list -->
|
|
|
|
|
|
|
|
{% if paginator.total_pages > 0 %}
|
2020-02-22 02:09:09 +03:00
|
|
|
{% include post-paginator.html %}
|
2019-09-30 15:38:41 +03:00
|
|
|
{% endif %}
|