aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/_includes
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-05-13 05:17:58 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2022-05-13 05:17:58 +0200
commit622d36084a2a03b9d27c939f5a11b2f8871f4aa3 (patch)
tree1bcbaac4bac0acfd300419f0c9bee9c6ad9522b2 /_includes
parentfeed: muted post excerpts (diff)
downloadjekyll-theme-622d36084a2a03b9d27c939f5a11b2f8871f4aa3.tar.gz
jekyll-theme-622d36084a2a03b9d27c939f5a11b2f8871f4aa3.zip
posts: separate include for post header
Diffstat (limited to '_includes')
-rw-r--r--_includes/jekyll-theme/posts/feed.html16
-rw-r--r--_includes/jekyll-theme/posts/header.html32
2 files changed, 33 insertions, 15 deletions
diff --git a/_includes/jekyll-theme/posts/feed.html b/_includes/jekyll-theme/posts/feed.html
index 5bcf14d..629e4ee 100644
--- a/_includes/jekyll-theme/posts/feed.html
+++ b/_includes/jekyll-theme/posts/feed.html
@@ -3,21 +3,7 @@
{% else %}
{% for post in paginator.posts %}
<a href="{{ post.url | relative_url }}" class="feed-entry">
- <div class="post-header">
- <h3>{{ post.title }}</h3>
- <div class="post-date">
- <p class="text-muted">
- {%- 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;<span class="category">{{ post.category }}</span>
- {%- endif -%}
- <span class="glyphicon glyphicon-time"></span>&nbsp;{{ post.date | date: '%-d&nbsp;%b&nbsp;%Y' }}
- </p>
- </div>
- </div>
+ {% include jekyll-theme/posts/header.html feed=true %}
<div class="text-muted">{{ post.excerpt | markdownify }}</div>
</a>
{% endfor %}
diff --git a/_includes/jekyll-theme/posts/header.html b/_includes/jekyll-theme/posts/header.html
new file mode 100644
index 0000000..cadbb95
--- /dev/null
+++ b/_includes/jekyll-theme/posts/header.html
@@ -0,0 +1,32 @@
+<div class="post-header">
+ {% assign h = 'h1' %}
+ {% if include.feed %}
+ {% assign h = 'h3' %}
+ {% else %}
+ {% assign post = page %}
+ {% endif %}
+ <{{ h }}>{{ post.title }}</{{ h }}>
+ <div class="post-date">
+ <p class="text-muted">
+ {%- 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">
+ {%- else -%}
+ <a class="category" href="{{ '/' | relative_url }}{{ post.category | slugify: 'pretty' }}/">
+ {%- endif -%}
+ {{ post.category }}
+ {%- if include.feed -%}
+ </span>
+ {%- else -%}
+ </a>
+ {%- endif -%}
+ {%- endif -%}
+ <span class="glyphicon glyphicon-time"></span>&nbsp;{{ post.date | date: '%-d&nbsp;%b&nbsp;%Y' }}
+ </p>
+ </div>
+</div>