summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Kuttler <git@kuttler.eu>2015-02-11 22:59:41 +0100
committerNicolas Kuttler <git@kuttler.eu>2015-02-11 23:20:29 +0100
commitaf2178c0b3b28b462209251aba685a2108c2e905 (patch)
treed66deb12e0f5f82127fed6525361bc24b46ab5b5
parent549b47e04bc63cfa7d7b3e4464e230c79f5080d8 (diff)
downloadirssi.github.io-af2178c0b3b28b462209251aba685a2108c2e905.zip
Add a basic front page with paginated news archive
-rw-r--r--_config.yml3
-rw-r--r--_includes/paginate.html37
-rw-r--r--_layouts/home.html12
-rw-r--r--_layouts/post.html3
-rw-r--r--index.html2
5 files changed, 56 insertions, 1 deletions
diff --git a/_config.yml b/_config.yml
index 7424ba6..f39f1c7 100644
--- a/_config.yml
+++ b/_config.yml
@@ -11,3 +11,6 @@ project: The Irssi Project
description: The Client of the Future
name: Irssi Core Team
email: staff@irssi.org
+
+paginate: 8
+paginate_path: "news/:num/"
diff --git a/_includes/paginate.html b/_includes/paginate.html
new file mode 100644
index 0000000..df2d75a
--- /dev/null
+++ b/_includes/paginate.html
@@ -0,0 +1,37 @@
+{% comment %}
+For the pagination styles see http://getbootstrap.com/components/#pagination
+{% endcomment %}
+<nav>
+ <ul class="pagination">
+ <li>
+ {% if paginator.previous_page %}
+ <a href="{{ paginator.previous_page_path }}" aria-label="Previous">
+ <span aria-hidden="true">&laquo;</span>
+ </a>
+ {% else %}
+ <span aria-hidden="true">&laquo;</span>
+ {% endif %}
+ </li>
+ {% comment %}
+ The first page is a special flower, see
+ http://jekyllrb.com/docs/pagination/
+ {% endcomment %}
+ <li{% if paginator.page == 1 %} class="active"{% endif %}>
+ <a href="/">1</a>
+ </li>
+ {% for i in (2..paginator.total_pages) %}
+ <li{% if paginator.page == i %} class="active"{% endif %}>
+ <a href="/{{ site.paginate_path | replace: ':num', i }}">{{ i }}</a>
+ </li>
+ {% endfor %}
+ <li>
+ {% if paginator.next_page %}
+ <a href="{{ paginator.next_page_path }}" aria-label="Next">
+ <span aria-hidden="true">&raquo;</span>
+ </a>
+ {% else %}
+ <span aria-hidden="true">&raquo;</span>
+ {% endif %}
+ </li>
+ </ul>
+</nav>
diff --git a/_layouts/home.html b/_layouts/home.html
new file mode 100644
index 0000000..9a2976a
--- /dev/null
+++ b/_layouts/home.html
@@ -0,0 +1,12 @@
+---
+layout: default
+---
+
+<h1>News{% if paginator.page > 1 %} Archive{% endif %}</h1>
+
+{% for post in paginator.posts %}
+ <h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
+ {{ post.content | markdownify }}
+{% endfor %}
+
+{% include paginate.html %}
diff --git a/_layouts/post.html b/_layouts/post.html
index 0d6905d..aa390ea 100644
--- a/_layouts/post.html
+++ b/_layouts/post.html
@@ -1,3 +1,6 @@
---
layout: default
---
+
+<h2>{{ page.title }}</h2>
+{{ page.content|markdownify }}
diff --git a/index.html b/index.html
index 0d6905d..e4d427d 100644
--- a/index.html
+++ b/index.html
@@ -1,3 +1,3 @@
---
-layout: default
+layout: home
---