web/_layouts/home.html

92 lines
2.5 KiB
HTML
Raw Normal View History

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 %}
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-06-07 11:21:10 +03:00
<div class="d-flex justify-content-between pr-xl-2">
2020-06-06 07:45:33 +03:00
<h1><a href="{{ post.url | relative_url }}">{{ post.title }}</a></h1>
{% if post.pin %}
2020-06-09 08:11:40 +03:00
<i class="fas fa-thumbtack fa-fw text-muted mt-1 ml-2 mt-xl-2" data-toggle="tooltip" data-placement="left"
2020-06-06 07:45:33 +03:00
title="Pinned"></i>
{% endif %}
</div>
2019-09-30 15:38:41 +03:00
<div class="post-content">
<p>
{% 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>
<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 }}
<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 %}