Skip to content

Commit fe1b2c4

Browse files
committed
Extract post.html include template
1 parent a2bcac1 commit fe1b2c4

3 files changed

Lines changed: 15 additions & 23 deletions

File tree

_includes/post.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<article class="post">
2+
<a href="{{ include.post.url }}">
3+
<h1 class="name">
4+
<time>{{ include.post.date | date_to_string }}</time>
5+
{{ include.post.title }}
6+
</h1>
7+
8+
<p class="body">
9+
{{ include.post.content }}
10+
</p>
11+
</a>
12+
</article>

_layouts/post.html

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,7 @@
77
<main class="content">
88
{% include header.html %}
99

10-
<article class="post">
11-
<h1 class="name">
12-
{% if page.date %}
13-
<time>{{ page.date | date_to_string }}</time>
14-
{% endif %}
15-
{{ page.title }}
16-
</h1>
17-
18-
<p class="body">
19-
{{ page.content }}
20-
</p>
21-
</article>
10+
{% include post.html post=page %}
2211
</main>
2312

2413
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

index.html

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,9 @@
55
<section class="blog">
66
<section class="posts">
77
{% for post in site.posts limit: 5 %}
8-
<article class="post">
9-
<a href="{{ post.url }}">
10-
<h1 class="name">
11-
{{ post.title }}
12-
<time>{{ post.date | date_to_string }}</time>
13-
</h1>
14-
</a>
158

16-
<p class="body">
17-
{{ post.content }}
18-
</p>
19-
</article>
9+
{% include post.html post=post %}
10+
2011
{% endfor %}
2112
</section>
2213

0 commit comments

Comments
 (0)