Skip to content

Commit 2f59c66

Browse files
committed
Move index.html to _layouts/home.html
1 parent df0d182 commit 2f59c66

File tree

3 files changed

+45
-33
lines changed

3 files changed

+45
-33
lines changed

.travis.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,21 @@ script:
2929
- cd pixyll-example
3030
- bundle install
3131
- mv index.md index.html
32-
- "sed -i~ -e 's/layout: home/layout: default/' index.html"
3332
- "echo paginate: 1 >> _config.yml"
3433
- "sed -i~ -e 's/minima/pixyll/' _config.yml"
3534
- "sed -i~ -e '/^gems:/a\\\n\\ \\ -\\ jekyll-paginate\n' _config.yml"
3635
- "sed -i~ -e '/^plugins:/a\\\n\\ \\ -\\ jekyll-paginate\n' _config.yml"
3736
- "sed -i~ -e 's/minima/pixyll/' Gemfile"
3837
- "sed -i~ -e '/the default theme/d' Gemfile"
38+
- "echo --- > _posts/$(date -u +'%Y-%m-%d')-hello-world.md"
39+
- "echo layout: post >> _posts/$(date -u '+%Y-%m-%d')-hello-world.md"
40+
- "echo title: Hello, world >> _posts/$(date -u '+%Y-%m-%d')-hello-world.md"
41+
- "echo -n 'date: ' >> _posts/$(date -u '+%Y-%m-%d')-hello-world.md"
42+
- "echo $(date -u +'%Y-%m-%d %H:%M:%S +0000') >> _posts/$(date -u '+%Y-%m-%d')-hello-world.md"
43+
- "echo --- >> _posts/$(date -u '+%Y-%m-%d')-hello-world.md"
44+
- "echo 'Hello, world!' >> _posts/$(date -u '+%Y-%m-%d')-hello-world.md"
3945
- bundle exec jekyll build
4046
- grep pixyll _site/index.html
47+
- grep post-title _site/index.html
48+
- grep pagination-item _site/index.html
49+
- grep Newer _site/index.html

_layouts/home.html

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
layout: default
3+
---
4+
{% assign posts_count = paginator.posts | size %}
5+
6+
<div class="home">
7+
{% if posts_count > 0 %}
8+
<div class="posts">
9+
{% for post in paginator.posts %}
10+
<div class="post py3">
11+
<p class="post-meta">
12+
{% if site.date_format %}
13+
{{ post.date | date: site.date_format }}
14+
{% else %}
15+
{{ post.date | date: "%b %-d, %Y" }}
16+
{% endif %}
17+
</p>
18+
<a href="{{ post.url | relative_url }}" class="post-link"><h3 class="h1 post-title">{{ post.title }}</h3></a>
19+
<span class="post-summary">
20+
{% if post.summary %}
21+
{{ post.summary }}
22+
{% else %}
23+
{{ post.excerpt }}
24+
{% endif %}
25+
</span>
26+
</div>
27+
{% endfor %}
28+
</div>
29+
30+
{% include pagination.html %}
31+
{% else %}
32+
<h1 class='center'>{{ site.text.index.coming_soon | default: "Coming soon..." }}</h1>
33+
{% endif %}
34+
</div>

index.html

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,3 @@
11
---
2-
layout: default
2+
layout: home
33
---
4-
{% assign posts_count = paginator.posts | size %}
5-
6-
<div class="home">
7-
{% if posts_count > 0 %}
8-
<div class="posts">
9-
{% for post in paginator.posts %}
10-
<div class="post py3">
11-
<p class="post-meta">
12-
{% if site.date_format %}
13-
{{ post.date | date: site.date_format }}
14-
{% else %}
15-
{{ post.date | date: "%b %-d, %Y" }}
16-
{% endif %}
17-
</p>
18-
<a href="{{ post.url | relative_url }}" class="post-link"><h3 class="h1 post-title">{{ post.title }}</h3></a>
19-
<span class="post-summary">
20-
{% if post.summary %}
21-
{{ post.summary }}
22-
{% else %}
23-
{{ post.excerpt }}
24-
{% endif %}
25-
</span>
26-
</div>
27-
{% endfor %}
28-
</div>
29-
30-
{% include pagination.html %}
31-
{% else %}
32-
<h1 class='center'>{{ site.text.index.coming_soon }}</h1>
33-
{% endif %}
34-
</div>

0 commit comments

Comments
 (0)