aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/_includes
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-10-28 07:39:20 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2022-10-28 11:11:20 +0200
commita768a7fa84577a5975fa782dd81cdab066dcff12 (patch)
tree14868bf9073c1b6d2f2fc861a0e4cac192c51f8c /_includes
parentposts: right-align the date (diff)
downloadjekyll-theme-a768a7fa84577a5975fa782dd81cdab066dcff12.tar.gz
jekyll-theme-a768a7fa84577a5975fa782dd81cdab066dcff12.zip
posts: redesign feed again
Put dates on the left, this looks nicer.
Diffstat (limited to '')
-rw-r--r--_includes/jekyll-theme/categories/all.html12
-rw-r--r--_includes/jekyll-theme/categories/category.html6
-rw-r--r--_includes/jekyll-theme/categories/label.html9
-rw-r--r--_includes/jekyll-theme/flex-header.html11
-rw-r--r--_includes/jekyll-theme/posts/date.html5
-rw-r--r--_includes/jekyll-theme/posts/feed.html4
-rw-r--r--_includes/jekyll-theme/posts/header.html35
-rw-r--r--_includes/jekyll-theme/sidebar/latest-posts.html4
8 files changed, 45 insertions, 41 deletions
diff --git a/_includes/jekyll-theme/categories/all.html b/_includes/jekyll-theme/categories/all.html
index d1c6285..c8d4720 100644
--- a/_includes/jekyll-theme/categories/all.html
+++ b/_includes/jekyll-theme/categories/all.html
@@ -4,20 +4,16 @@
{% assign categories = site.categories | sort %}
{% for category in categories %}
{% assign category_name = category[0] %}
- <h2>{% include jekyll-theme/categories/label.html category=category_name %}</h2>
+ <h2>{% include jekyll-theme/categories/label.html link=true category=category_name monospace=true %}</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>
+ {% include jekyll-theme/posts/header.html url=post.url title=post.title date=post.date %}
{% endfor %}
{% endfor %}
{% assign uncategorized = site.posts | where_exp: "post","post.categories.size == 0" %}
{% if uncategorized.size != 0 %}
- <h2>{% include jekyll-theme/categories/label.html category="Other" feed=true %}</h2>
+ <h2>{% include jekyll-theme/categories/label.html category="Other" monospace=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>
+ {% include jekyll-theme/posts/header.html url=post.url title=post.title date=post.date %}
{% endfor %}
{% endif %}
{% endif %}
diff --git a/_includes/jekyll-theme/categories/category.html b/_includes/jekyll-theme/categories/category.html
index a33fd76..e14a981 100644
--- a/_includes/jekyll-theme/categories/category.html
+++ b/_includes/jekyll-theme/categories/category.html
@@ -1,9 +1,7 @@
-<h1>{% include jekyll-theme/categories/label.html category=include.category feed=true %}</h1>
+<h1>{% include jekyll-theme/categories/label.html category=include.category monospace=true %}</h1>
{% if site.categories[include.category].size > 0 %}
{% 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>
+ {% include jekyll-theme/posts/header.html url=post.url title=post.title date=post.date %}
{% endfor %}
{% endif %}
{% if include.archive_link %}
diff --git a/_includes/jekyll-theme/categories/label.html b/_includes/jekyll-theme/categories/label.html
index 4345df2..f556de1 100644
--- a/_includes/jekyll-theme/categories/label.html
+++ b/_includes/jekyll-theme/categories/label.html
@@ -1,6 +1,9 @@
+{%- capture url -%}{{ '/' | relative_url }}{{ include.category | slugify: 'pretty' }}{%- endcapture -%}
+{%- assign label = include.category | downcase -%}
+
<span class="glyphicon glyphicon-folder-open"></span>&nbsp;
-{%- if include.feed -%}
- <span class="category text-monospace">{{ include.category | downcase }}</span>
+{%- if include.link -%}
+ <a class="category{% if include.monospace %} text-monospace{% endif %}" href="{{ url }}/">{{ label }}</a>
{%- else -%}
- <a class="category text-monospace" href="{{ '/' | relative_url }}{{ include.category | slugify: 'pretty' }}/">{{ include.category | downcase }}</a>
+ <span class="category{% if include.monospace %} text-monospace{% endif %}">{{ label }}</span>
{%- endif -%}
diff --git a/_includes/jekyll-theme/flex-header.html b/_includes/jekyll-theme/flex-header.html
new file mode 100644
index 0000000..6048991
--- /dev/null
+++ b/_includes/jekyll-theme/flex-header.html
@@ -0,0 +1,11 @@
+<div class="flex-header" style="flex-wrap: wrap;">
+ <div class="flex-header">
+ {% if include.left %}
+ <p class="flex-header-left text-muted font-size-90">{{ include.left }}</p>
+ {% endif %}
+ <div class="flex-header-title">{{ include.title }}</div>
+ </div>
+ {% if include.right %}
+ <p class="flex-header-right text-muted font-size-90">{{ include.right }}</p>
+ {% endif %}
+</div>
diff --git a/_includes/jekyll-theme/posts/date.html b/_includes/jekyll-theme/posts/date.html
new file mode 100644
index 0000000..4d36bd3
--- /dev/null
+++ b/_includes/jekyll-theme/posts/date.html
@@ -0,0 +1,5 @@
+{% assign fmt = include.fmt %}
+{% unless fmt %}
+ {% assign fmt = "%F" %}
+{% endunless %}
+<span class="glyphicon glyphicon-time"></span>&nbsp;<span{% if include.monospace %} class="text-monospace"{% endif %}>{{ include.date | date: fmt }}</span>
diff --git a/_includes/jekyll-theme/posts/feed.html b/_includes/jekyll-theme/posts/feed.html
index 1fff024..5d45cd3 100644
--- a/_includes/jekyll-theme/posts/feed.html
+++ b/_includes/jekyll-theme/posts/feed.html
@@ -2,9 +2,7 @@
<p class="h3">Sorry, no posts have been added yet.</p>
{% else %}
{% for post in paginator.posts %}
- <a href="{{ post.url | relative_url }}" class="feed-entry">
- {% include jekyll-theme/posts/header.html feed=true title=post.title date=post.date category=post.category %}
- </a>
+ {% include jekyll-theme/posts/header.html url=post.url date=post.date title=post.title category=post.category %}
{% endfor %}
{% include jekyll-theme/posts/paginator.html %}
{% endif %}
diff --git a/_includes/jekyll-theme/posts/header.html b/_includes/jekyll-theme/posts/header.html
index 9acea37..d170ae9 100644
--- a/_includes/jekyll-theme/posts/header.html
+++ b/_includes/jekyll-theme/posts/header.html
@@ -1,22 +1,15 @@
-<div class="post-header">
- {% if include.feed %}
- <h5 class="text-monospace">{{ include.title }}</h5>
- {% else %}
- <h1><span class="font-size-90">{{ include.title }}</span></h1>
- {% endif %}
+{% assign header_date = null %}
+{% if include.date %}
+ {% capture header_date %}{%- include jekyll-theme/posts/date.html date=include.date monospace=true -%}{% endcapture %}
+{% 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 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 -%}
- </p>
- </div>
-</div>
+{% assign header_category = null %}
+{% if include.category %}
+ {% capture header_category %}{%- include jekyll-theme/categories/label.html category=include.category monospace=true -%}{% endcapture %}
+{% endif %}
+
+{% capture header_title %}<h5 class="text-monospace">{{ include.title }}</h5>{% endcapture %}
+
+<a href="{{ include.url | relative_url }}" class="feed-entry">
+ {% include jekyll-theme/flex-header.html left=header_date title=header_title right=header_category %}
+</a>
diff --git a/_includes/jekyll-theme/sidebar/latest-posts.html b/_includes/jekyll-theme/sidebar/latest-posts.html
index 17251e3..5ba1cac 100644
--- a/_includes/jekyll-theme/sidebar/latest-posts.html
+++ b/_includes/jekyll-theme/sidebar/latest-posts.html
@@ -8,9 +8,9 @@
</div>
{% for post in site.posts limit: 5 %}
<a class="list-group-item" href="{{ post.url | relative_url }}">
- <h5 class="list-group-item-heading post-header">
+ <h5 class="list-group-item-heading flex-header">
<span>{{ post.title }}</span>
- <small class="post-date"><span class="glyphicon glyphicon-time"></span>&nbsp;{{ post.date | date: '%-d %b %Y' }}</small>
+ <small class="flex-header-right">{% include jekyll-theme/posts/date.html date=post.date fmt='%-d %b %Y' %}</small>
</h5>
</a>
{% endfor %}