๐Ÿ“ฆ Chocorean / chocorean.github.io

๐Ÿ“„ blog.html ยท 41 lines
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---
layout: default
title: Blog
permalink: /blog
---
{%- if site.posts.size > 0 -%}
<ul class="post-list">
  {%- for post in site.posts -%}
  <li class="blog-post" onclick="goToLink()">
    <a class="blog-link" href="{{ post.url | relative_url }}">
      <div class="post-title-date">
        <h3>{{ post.title | escape }}</h3>
        {%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%}
        <span class="post-date">{{ post.date | date: date_format }}</span>
      </div>
      <div class="post-subtitle-tags">
        <h4>{{ post.subtitle | escape }}</h4>
        <ul class="post-tags">
          {%- for tag in post.tags -%}
          <li>{{ tag }}</li>
          {% if forloop.last == false %}
          &nbsp;
          {% endif %}
          {%- endfor -%}
        </ul>
      </div>
      <hr class="sep" />
      <div class="excerpt">{{ post.excerpt }}</div>
    </a>
  </li>
  {%- endfor -%}
</ul>
{%- endif -%}
<script>
  function goToLink() {
    const firstChild = event.currentTarget.querySelector('a');
    if (firstChild) {
      firstChild.click();
    }
  }
</script>