diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2015-08-24 16:02:46 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2015-08-24 16:02:46 +0200 |
commit | f42e64968ffd0e4adfe67d484dc2768186269fb1 (patch) | |
tree | 4403f46b8af25d4d4a50ec1d9ebaf5496958f6b3 | |
parent | 3c864f320b90c8bdd2419a93db51faf67db05473 (diff) | |
download | norsk-urskog-main-f42e64968ffd0e4adfe67d484dc2768186269fb1.tar.gz norsk-urskog-main-f42e64968ffd0e4adfe67d484dc2768186269fb1.tar.bz2 norsk-urskog-main-f42e64968ffd0e4adfe67d484dc2768186269fb1.zip |
Add pagination for index page.
-rw-r--r-- | blog/_config.yml | 1 | ||||
-rw-r--r-- | blog/_i18n/en.yml | 3 | ||||
-rw-r--r-- | blog/_i18n/nb.yml | 3 | ||||
-rw-r--r-- | blog/index.html | 18 |
4 files changed, 23 insertions, 2 deletions
diff --git a/blog/_config.yml b/blog/_config.yml index 73cb084..b16cdc5 100644 --- a/blog/_config.yml +++ b/blog/_config.yml @@ -2,6 +2,7 @@ languages: ["nb", "en"] exclude_from_localizations: ["assets", "css"] title: Norsk Urskog +paginate: 5 defaults: - scope: diff --git a/blog/_i18n/en.yml b/blog/_i18n/en.yml index e9acbae..874d9c8 100644 --- a/blog/_i18n/en.yml +++ b/blog/_i18n/en.yml @@ -12,3 +12,6 @@ home: latest_news: Latest news links: Links older_news: Older news... + page_no: Page + next_page: Next + prev_page: Previous diff --git a/blog/_i18n/nb.yml b/blog/_i18n/nb.yml index 27bac90..1d4ea60 100644 --- a/blog/_i18n/nb.yml +++ b/blog/_i18n/nb.yml @@ -12,3 +12,6 @@ home: latest_news: Siste nyheter links: Lenker older_news: Eldre nyheter... + page_no: Side + next_page: Neste + prev_page: Forrige diff --git a/blog/index.html b/blog/index.html index 512e009..aaf8fbd 100644 --- a/blog/index.html +++ b/blog/index.html @@ -8,7 +8,7 @@ hidden: true <section id="news" class="wide"> <h2>{% t home.latest_news %}</h2> - {% for p in site.posts limit: 5 %} + {% for p in paginator.posts %} <article> <header> <date>{{ p.date | date_to_string }}</date> @@ -21,7 +21,6 @@ hidden: true </section> </article> {% endfor %} - <a href="{{ '/archive.html' | prepend: site.baseurl }}">{% t home.older_news %}</a> </section> {% if site.links %} @@ -29,3 +28,18 @@ hidden: true <h2>{% t home.links %}</h2> </section> {% endif %} + +<!-- Pagination links --> +<div class="pagination"> + {% if paginator.previous_page %} + <a href="{{ paginator.previous_page_path | prepend: site.baseurl }}" class="previous">{% t home.prev_page %}</a> + {% else %} + <span class="previous">{% t home.prev_page %}</span> + {% endif %} + <span class="page_number ">{% t home.page_no %} {{ paginator.page }} / {{ paginator.total_pages }}</span> + {% if paginator.next_page %} + <a href="{{ paginator.next_page_path | prepend: site.baseurl }}" class="next">{% t home.next_page %}</a> + {% else %} + <span class="next ">{% t home.next_page %}</span> + {% endif %} +</div> |