2019-09-30 15:38:41 +03:00
|
|
|
---
|
|
|
|
layout: page
|
|
|
|
# The Home page layout
|
2020-01-02 16:17:49 +03:00
|
|
|
# v2.0
|
|
|
|
# https://github.com/cotes2020/jekyll-theme-chirpy
|
2019-09-30 15:38:41 +03:00
|
|
|
# © 2017-2019 Cotes Chung
|
|
|
|
# MIT Licensed
|
|
|
|
---
|
|
|
|
|
2020-06-06 07:45:33 +03:00
|
|
|
|
|
|
|
{% assign pinned = site.posts | where_exp: "item", "item.pin == true" %}
|
|
|
|
|
|
|
|
{% assign default = site.posts | where_exp: "item", "item.pin == nil " %}
|
|
|
|
|
|
|
|
{% 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 %}
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Get defualt posts -->
|
|
|
|
|
|
|
|
{% 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-06-06 07:45:33 +03:00
|
|
|
<div class="d-flex justify-content-between align-items-center pr-2">
|
|
|
|
<h1><a href="{{ post.url | relative_url }}">{{ post.title }}</a></h1>
|
|
|
|
{% if post.pin %}
|
|
|
|
<i class="fas fa-thumbtack fa-fw fa-sm text-muted pinned" data-toggle="tooltip" data-placement="top"
|
|
|
|
title="Pinned"></i>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2019-09-30 15:38:41 +03:00
|
|
|
<div class="post-content">
|
|
|
|
<p>
|
2020-05-05 19:39:28 +03:00
|
|
|
{% assign _content = post.content %}
|
|
|
|
{% include no-linenos.html %}
|
|
|
|
{{ _content | markdownify | strip_html | truncate: 200 }}
|
2019-09-30 15:38:41 +03:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
2020-04-07 15:23:57 +03:00
|
|
|
<div class="post-meta text-muted">
|
2019-09-30 15:38:41 +03:00
|
|
|
<!-- posted date -->
|
|
|
|
<i class="far fa-clock fa-fw"></i>
|
2020-02-22 02:16:58 +03:00
|
|
|
<span class="timeago" data-toggle="tooltip" data-placement="bottom"
|
|
|
|
title="{{ post.date | date: site.data.date_format.tooltip }}">
|
|
|
|
{{ post.date | date: site.data.date_format.post }}
|
2019-12-31 18:17:27 +03:00
|
|
|
<i class="unloaded">{{ post.date | date_to_xmlschema }}</i>
|
2019-09-30 15:38:41 +03:00
|
|
|
</span>
|
|
|
|
<!-- page views -->
|
2020-04-01 15:33:49 +03:00
|
|
|
{% if site.google_analytics.pv.enabled %}
|
2019-09-30 15:38:41 +03:00
|
|
|
<i class="far fa-eye fa-fw"></i>
|
|
|
|
<span id="pv_{{-post.title-}}" class="pageviews">
|
2019-12-17 14:26:11 +03:00
|
|
|
<i class="fas fa-spinner fa-spin fa-fw"></i>
|
2019-09-30 15:38:41 +03:00
|
|
|
</span>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</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 %}
|