Repository navigation
Expand file tree
/
Copy pathblog.html
More file actions
43 lines (41 loc) · 1.61 KB
/
Copy pathblog.html
File metadata and controls
43 lines (41 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---
layout: default
title: Blog
permalink: /blog/
---
<div class="wrapper blog">
<header class="blog-header">
<h1 class="post-title">Blog</h1>
</header>
{% assign posts = site.posts | sort: "date" | reverse %}
<ul class="post-list">
{% for post in posts %}
<li class="post-list-item">
<h2 class="post-list-title"><a href="{{ post.url }}">{{ post.title }}</a></h2>
<div class="post-meta">
{% if post.author %}{{ post.author }} <span class="meta-sep" aria-hidden="true">·</span>{% endif %}
<time datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date: "%B %-d, %Y" }}</time>
</div>
{% comment %}
Use the first real paragraph as the excerpt: some posts open with a
heading or a one-liner, which makes for a poor summary.
{% endcomment %}
{% assign excerpt = post.excerpt | strip_html | strip_newlines | strip %}
{% assign excerpt_words = excerpt | number_of_words %}
{% if excerpt_words < 15 %}
{% assign paragraphs = post.content | split: "<p>" %}
{% for para in paragraphs offset: 1 %}
{% assign candidate = para | split: "</p>" | first | strip_html | strip_newlines | strip %}
{% assign candidate_words = candidate | number_of_words %}
{% if candidate_words >= 15 %}
{% assign excerpt = candidate %}
{% break %}
{% endif %}
{% endfor %}
{% endif %}
<p class="post-excerpt">{{ excerpt | truncatewords: 50 }}</p>
<a class="post-readmore" href="{{ post.url }}">Read more →</a>
</li>
{% endfor %}
</ul>
</div>