-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathblog.html
79 lines (60 loc) · 2.69 KB
/
blog.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
title: Blog
---
{%- assign vars = site.data.vars -%}
{%- assign i18n = site.data.i18n -%}
{%- if page.lang != site.lang -%}
{%- assign go_i18n = true -%}
{%- endif -%}
{%- assign member_page = vars.navbar.links | where: "label", "Members" | first -%}
{%- assign member_page_url = member_page.url -%}
{% if go_i18n %}
{% assign member_page_url = member_page.i18n[page.lang].url %}
{% endif %}
<section id="posts">
<h1>{{ i18n.tr[page.lang].all_posts | default: "???" }}</h1>
<ul class="posts-list">
{%- assign posts = site.posts -%}
{%- assign tags_page = "/tags/" -%}
{%- if go_i18n -%}
{%- assign tags_page = "/" | append: page.lang | append: tags_page -%}
{%- endif -%}
{% for post in posts %}
{% assign author = site.members | where: "nickname", post.author_nickname | first %}
{% assign author_url = author.url %}
{% assign author_name = author.name %}
{% assign author_nickname = author.nickname %}
{% assign author_avatar = author.avatar %}
{% unless author %}
{% assign author_url = "" %}
{% assign author_avatar = "/assets/img/avatar.png" %}
{% assign author_name = post.author %}
{% assign author_nickname = post.author_nickname %}
{% endunless %}
<li class="post-item {% if post.tags contains 'announcement' %}announcement{% endif %}" onclick="openUrl('{{ post.url }}')">
<ul class="post-tags">
{% for tag in post.tags %}
<li class="post-tag-item rounded-sm">
<a href="{{ tags_page | append: '#' | append: tag | realtive_url }}" class="raw-link post-tag-link">#{{ tag }}</a>
</li>
{% endfor %}
</ul>
<img src="{{ '/assets/img/banners/' | append: post.banner | relative_url }}" alt="Post banner" class="post-banner">
<div class="post-info">
<h3 class="post-title">
<a href="{{ post.url }}" class="raw-link post-title-link">{{ post.title }}</a>
<img src="/assets/img/flag-{{ post.lang }}.svg" class="language-flag-indicator">
</h3>
<p class="post-description">{{ post.description }}</p>
</div>
<div class="post-info-footer">
<span class="post-date"><img src="{{ author_avatar }}" alt="" class="author-avatar"><a href="{{ author_url }}" class="raw-link author-nick-url">{{ author_nickname }}</a> / {{ post.date | date_to_string }}</span>
<a href="{{ post.url }}" class="raw-link post-link rounded-lg">{{ i18n.tr[page.lang].read_more | default: "???" }}</a>
</div>
</li>
{% endfor %}
{% for _ in (0..count) %}
<li class="no-post-item"><!-- No post item --></li>
{% endfor %}
</ul>
</section>