Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
67 lines (56 loc) · 2.26 KB
/
Copy pathindex.html
File metadata and controls
67 lines (56 loc) · 2.26 KB
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
---
layout: default
---
<div class="posts">
{% for post in paginator.posts %}
<article class="post">
<h1 class="title"><a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a></h1>
<h4 class="date">published <date>{{ post.date | date_to_string }}</date></h4>
<div class="entry">
{% assign excerpt_content = post.excerpt | strip %}
{% assign full_content = post.content | strip %}
{% if excerpt_content != full_content %}
{{ post.excerpt }}
{% else %}
{{ post.content }}
{% endif %}
</div>
{% if excerpt_content != full_content %}
...
{% assign words = post.content | number_of_words %}
{% assign minutes = words | divided_by: 200 %}
{% if minutes == 0 %}
{% assign minutes = 1 %}
{% endif %}
<a href="{{ site.baseurl }}{{ post.url }}" class="read-more">continue reading (~{{ minutes }} min read)</a>
|
{% endif %}
<a href="{{ site.baseurl }}{{ post.url }}#comments" class="read-more">
<span class="comment-count" data-schnack-slug="{{ post.slug }}">
<span class="loading">comments</span>
</span>
</a>
</article>
{% endfor %}
</div>
<script>
document.querySelectorAll('.comment-count').forEach(async (el) => {
const slug = el.dataset.schnackSlug;
try {
const response = await fetch(`https://comments.ppy.sh/comments/${slug}`);
const data = await response.json();
const count = data.comments ? data.comments.length : 0;
el.innerHTML = count === 1 ? '1 comment' : `${count} comments`;
} catch (error) {
}
});
</script>
<!-- Pagination links -->
<div class="pagination">
{% if paginator.previous_page %}
<a href="{{ paginator.previous_page_path }}" class="previous">« newer</a> {% else %}
<span class="previous">« newer</span> {% endif %}
<span class="page_number ">page {{ paginator.page }} of {{ paginator.total_pages }}</span> {% if paginator.next_page %}
<a href="{{ paginator.next_page_path }}" class="next">older »</a> {% else %}
<span class="next ">older »</span> {% endif %}
</div>