diff options
author | Santiago Soler <santiago.r.soler@gmail.com> | 2021-03-27 13:56:17 -0300 |
---|---|---|
committer | Santiago Soler <santiago.r.soler@gmail.com> | 2021-03-27 13:56:17 -0300 |
commit | 98ac930abd09e79ce6e2c22e809eea53bdd98110 (patch) | |
tree | 5faeafdf9399c81c21954d0b769d6c5348cd5279 /_layouts | |
parent | 3a38020e308ed85a6cccd32a8c5a008ff67d576d (diff) | |
download | website-98ac930abd09e79ce6e2c22e809eea53bdd98110.tar.gz |
Enable categories and update the template tutorial
Diffstat (limited to '_layouts')
-rw-r--r-- | _layouts/home.html | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/_layouts/home.html b/_layouts/home.html index 654be00..26d255c 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -15,6 +15,25 @@ layout: base <h1>Blog</h1> + {% if site.show_categories %} + <ul class="categories-list"> + {% for category in site.categories %} + {% capture category_name %}{{ category | first }}{% endcapture %} + <li> + <h2 class="category">{{ category_name }}</h2> + <ul class="posts-list"> + {% for post in site.categories[category_name] %} + <li> + <h3><a href="{{ post.url | relative_url }}">{{ post.title }}</a></h3> + <p><em>{{ post.date | date: "%Y-%m-%d"}}</em></p> + {% if site.show-excerpt %}<p>{{ post.excerpt }}</p>{% endif %} + <li> + {% endfor %} + </ul> + </li> + {% endfor %} + </ul> + {% else %} <ul class="posts-list"> {% for post in site.posts %} <li> @@ -24,6 +43,7 @@ layout: base </li> {% endfor %} </ul> + {% endif %} {{ content }} </main> |