aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-10-24 20:36:56 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2022-10-25 11:44:37 +0200
commit18664118c08300b0e4a82ac225cc62b8b1513a7f (patch)
tree067085f3d7477bca74d70ce5d1d587be0c5a4237
parent_layouts: sidebar separator only for posts and pages (diff)
downloadjekyll-theme-18664118c08300b0e4a82ac225cc62b8b1513a7f.tar.gz
jekyll-theme-18664118c08300b0e4a82ac225cc62b8b1513a7f.zip
categories: redesign
Re-use some of posts includes so that categories pages look much cooler.
-rw-r--r--_includes/jekyll-theme/categories/all.html25
-rw-r--r--_includes/jekyll-theme/categories/category.html13
-rw-r--r--_includes/jekyll-theme/categories/label.html6
-rw-r--r--_includes/jekyll-theme/posts/feed.html2
-rw-r--r--_includes/jekyll-theme/posts/header.html23
-rw-r--r--_layouts/post.html2
-rw-r--r--code/index.html1
-rw-r--r--features/index.html1
8 files changed, 37 insertions, 36 deletions
diff --git a/_includes/jekyll-theme/categories/all.html b/_includes/jekyll-theme/categories/all.html
index 82efce5..d1c6285 100644
--- a/_includes/jekyll-theme/categories/all.html
+++ b/_includes/jekyll-theme/categories/all.html
@@ -3,20 +3,21 @@
{% else %}
{% assign categories = site.categories | sort %}
{% for category in categories %}
- <h2><a class="category" href="{{ '/' | relative_url }}{{ category[0] | slugify: 'pretty' }}/">{{ category[0] }}</a></h2>
- <ul>
- {% for post in category[1] %}
- <li><a href="{{ post.url | relative_url }}">{{ post.date | date: "%Y-%m-%d" }} &mdash; {{ post.title }}</a></li>
- {% endfor %}
- </ul>
+ {% assign category_name = category[0] %}
+ <h2>{% include jekyll-theme/categories/label.html category=category_name %}</h2>
+ {% for post in category[1] %}
+ <a href="{{ post.url | relative_url }}" class="feed-entry">
+ {% include jekyll-theme/posts/header.html feed=true title=post.title date=post.date %}
+ </a>
+ {% endfor %}
{% endfor %}
{% assign uncategorized = site.posts | where_exp: "post","post.categories.size == 0" %}
{% if uncategorized.size != 0 %}
- <h2>Other</h2>
- <ul>
- {% for post in uncategorized %}
- <li><a href="{{ post.url | relative_url }}">{{ post.date | date: "%Y-%m-%d" }} &mdash; {{ post.title }}</a></li>
- {% endfor %}
- </ul>
+ <h2>{% include jekyll-theme/categories/label.html category="Other" feed=true %}</h2>
+ {% for post in uncategorized %}
+ <a href="{{ post.url | relative_url }}" class="feed-entry">
+ {% include jekyll-theme/posts/header.html feed=true title=post.title date=post.date %}
+ </a>
+ {% endfor %}
{% endif %}
{% endif %}
diff --git a/_includes/jekyll-theme/categories/category.html b/_includes/jekyll-theme/categories/category.html
index f7b7a8c..a33fd76 100644
--- a/_includes/jekyll-theme/categories/category.html
+++ b/_includes/jekyll-theme/categories/category.html
@@ -1,11 +1,12 @@
-<p>This is a list of posts in category "{{ include.category }}".</p>
+<h1>{% include jekyll-theme/categories/label.html category=include.category feed=true %}</h1>
{% if site.categories[include.category].size > 0 %}
- <ul>
- {% for post in site.categories[include.category] %}
- <li><a href="{{ post.url | relative_url }}">{{ post.date | date: "%Y-%m-%d" }} &mdash; {{ post.title }}</a></li>
- {% endfor %}
- </ul>
+ {% for post in site.categories[include.category] %}
+ <a href="{{ post.url | relative_url }}" class="feed-entry">
+ {% include jekyll-theme/posts/header.html feed=true title=post.title date=post.date %}
+ </a>
+ {% endfor %}
{% endif %}
{% if include.archive_link %}
<p>For a complete list of posts grouped by category, please see <a href="{{ include.archive_link | relative_url }}">this page</a>.</p>
+ {% include jekyll-theme/sidebar/sep.html %}
{% endif %}
diff --git a/_includes/jekyll-theme/categories/label.html b/_includes/jekyll-theme/categories/label.html
new file mode 100644
index 0000000..4345df2
--- /dev/null
+++ b/_includes/jekyll-theme/categories/label.html
@@ -0,0 +1,6 @@
+<span class="glyphicon glyphicon-folder-open"></span>&nbsp;
+{%- if include.feed -%}
+ <span class="category text-monospace">{{ include.category | downcase }}</span>
+{%- else -%}
+ <a class="category text-monospace" href="{{ '/' | relative_url }}{{ include.category | slugify: 'pretty' }}/">{{ include.category | downcase }}</a>
+{%- endif -%}
diff --git a/_includes/jekyll-theme/posts/feed.html b/_includes/jekyll-theme/posts/feed.html
index 7f5c0c6..1fff024 100644
--- a/_includes/jekyll-theme/posts/feed.html
+++ b/_includes/jekyll-theme/posts/feed.html
@@ -3,7 +3,7 @@
{% else %}
{% for post in paginator.posts %}
<a href="{{ post.url | relative_url }}" class="feed-entry">
- {% include jekyll-theme/posts/header.html feed=true %}
+ {% include jekyll-theme/posts/header.html feed=true title=post.title date=post.date category=post.category %}
</a>
{% endfor %}
{% include jekyll-theme/posts/paginator.html %}
diff --git a/_includes/jekyll-theme/posts/header.html b/_includes/jekyll-theme/posts/header.html
index eabb22c..9acea37 100644
--- a/_includes/jekyll-theme/posts/header.html
+++ b/_includes/jekyll-theme/posts/header.html
@@ -2,30 +2,21 @@
{% if include.feed %}
<h5 class="text-monospace">{{ include.title }}</h5>
{% else %}
- {% assign post = page %}
- <h1><span class="font-size-90">{{ post.title }}</span></h1>
+ <h1><span class="font-size-90">{{ include.title }}</span></h1>
{% endif %}
+
<div class="post-date">
<p class="text-muted font-size-90">
{%- comment -%}
Collapse the Liquid whitespace here, so that no extra spaces
between <span>s are introduced.
{%- endcomment -%}
- {%- if post.category -%}
- <span class="glyphicon glyphicon-folder-open"></span>&nbsp;
- {%- if include.feed -%}
- <span class="category text-monospace">
- {%- else -%}
- <a class="category text-monospace" href="{{ '/' | relative_url }}{{ post.category | slugify: 'pretty' }}/">
- {%- endif -%}
- {{ post.category }}
- {%- if include.feed -%}
- </span>
- {%- else -%}
- </a>
- {%- endif -%}
+ {%- if include.category -%}
+ {% include jekyll-theme/categories/label.html category=include.category feed=include.feed %}
+ {%- endif -%}
+ {%- if include.date -%}
+ <span class="glyphicon glyphicon-time"></span>&nbsp;<span class="text-monospace">{{ include.date | date: '%d-%b-%Y' }}</span>
{%- endif -%}
- <span class="glyphicon glyphicon-time"></span>&nbsp;<span class="text-monospace">{{ post.date | date: '%d-%b-%Y' }}</span>
</p>
</div>
</div>
diff --git a/_layouts/post.html b/_layouts/post.html
index 6ac37f7..674b810 100644
--- a/_layouts/post.html
+++ b/_layouts/post.html
@@ -1,6 +1,6 @@
---
layout: default
---
-{% include jekyll-theme/posts/header.html %}
+{% include jekyll-theme/posts/header.html title=page.title date=page.date category=page.category %}
{{ content }}
{% include jekyll-theme/sidebar/sep.html %}
diff --git a/code/index.html b/code/index.html
index 002a9a5..ed70911 100644
--- a/code/index.html
+++ b/code/index.html
@@ -1,4 +1,5 @@
---
title: Code
+layout: default
---
{% include jekyll-theme/categories/category.html category=page.title archive_link='/archive/' %}
diff --git a/features/index.html b/features/index.html
index 3bd02e3..fd9e61d 100644
--- a/features/index.html
+++ b/features/index.html
@@ -1,4 +1,5 @@
---
title: Features
+layout: default
---
{% include jekyll-theme/categories/category.html category=page.title archive_link='/archive/' %}