diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2022-05-13 05:17:58 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2022-05-13 05:17:58 +0200 |
commit | 622d36084a2a03b9d27c939f5a11b2f8871f4aa3 (patch) | |
tree | 1bcbaac4bac0acfd300419f0c9bee9c6ad9522b2 /_includes | |
parent | feed: muted post excerpts (diff) | |
download | jekyll-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.html | 16 | ||||
-rw-r--r-- | _includes/jekyll-theme/posts/header.html | 32 |
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> <span class="category">{{ post.category }}</span> - {%- endif -%} - <span class="glyphicon glyphicon-time"></span> {{ post.date | date: '%-d %b %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> + {%- 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> {{ post.date | date: '%-d %b %Y' }} + </p> + </div> +</div> |