diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2021-04-09 23:16:02 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2021-04-09 23:16:02 +0300 |
commit | 5017c2a67603996de88e6c89ce7e5248af2cd948 (patch) | |
tree | 229069c025277e8ebea4bb79cbd957bc9d5118a2 /_includes/categories/categories.html | |
parent | categories: adjust links, optional archive link (diff) | |
download | jekyll-theme-5017c2a67603996de88e6c89ce7e5248af2cd948.tar.gz jekyll-theme-5017c2a67603996de88e6c89ce7e5248af2cd948.zip |
categories: list uncategorized posts too
Diffstat (limited to '')
-rw-r--r-- | _includes/categories/categories.html | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/_includes/categories/categories.html b/_includes/categories/categories.html index 960423a..a988a3f 100644 --- a/_includes/categories/categories.html +++ b/_includes/categories/categories.html @@ -1,4 +1,7 @@ -{% if site.categories.size != 0 %} +{% if site.posts.size == 0 %} + <p>Sorry, no posts have been added yet.</p> + <hr/> +{% else %} {% for category in site.categories %} <h1><a class="category" href="{{ '/' | relative_url }}{{ category[0] | slugify: 'pretty' }}/">{{ category[0] }}</a></h1> <hr/> @@ -8,7 +11,14 @@ {% endfor %} </ul> {% endfor %} -{% else %} - <p>Sorry, no posts have been added yet.</p> - <hr/> + {% assign uncategorized = site.posts | where_exp: "post","post.categories.size == 0" %} + {% if uncategorized.size != 0 %} + <h1>Other</h1> + <hr/> + <ul> + {% for post in uncategorized %} + <li><a href="{{ post.url | relative_url }}">{{ post.date | date: "%Y-%m-%d" }} — {{ post.title }}</a></li> + {% endfor %} + </ul> + {% endif %} {% endif %} |