forked from arkadianriver/arkadianriver.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd4c0e7
commit f75b5ae
Showing
4 changed files
with
86 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{% comment %} | ||
# Get a grouped and sorted array of posts | ||
# include-params: unsorted, groupby, sortby | ||
# returns: sorted_list array | ||
# Grouped sort from: | ||
# https://gist.github.com/budparr/0ad4a7449f9604f47eec | ||
# Jekyll group_by structures have the form | ||
# [{ 'name'=>group_by_field, 'items'=>[items_in_group] },...] | ||
{% endcomment | ||
%}{% assign sorted_list = site.empty_array | ||
%}{% assign items_grouped = include.unsorted | group_by: include.groupby | sort: 'name' | reverse | ||
%}{% for group in items_grouped | ||
%}{% assign items = group.items | sort: include.sortby | reverse | ||
%}{% for item in items | ||
%}{% assign sorted_list = sorted_list | push: item | ||
%}{% endfor | ||
%}{% endfor | ||
%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{% comment %} | ||
# Find this post in sorted_list and get back/next | ||
# depends: sorted_list of posts | ||
# include-params: posclass - indicates whether top or bottom style | ||
# returns: displays navigation using included backnextnav.html | ||
# Original idea: | ||
# https://gist.github.com/budparr/3e637e575471401d01ec | ||
{% endcomment | ||
%}{% for post in sorted_list | ||
%}{% if post.title == page.title | ||
%}{% unless forloop.first | ||
%}{% assign prevbutton = '< Back' | ||
%}{% assign prevurl = prev.url | ||
%}{% assign prevtitle = prev.title | ||
%}{% else | ||
%}{% assign prevbutton = 'Index' | ||
%}{% assign prevurl = perma | prepend: baseurl | ||
%}{% assign prevtitle = 'Works Index' | ||
%}{% endunless | ||
%}{% unless forloop.last | ||
%}{% assign next = sorted_list[forloop.index] | ||
%}{% assign nextbutton = 'Next >' | ||
%}{% assign nexturl = next.url | ||
%}{% assign nexttitle = next.title | ||
%}{% else | ||
%}{% assign nextbutton = 'Index' | ||
%}{% assign nexturl = perma | prepend: baseurl | ||
%}{% assign nexttitle = 'Works Index' | ||
%}{% endunless | ||
%}{% endif | ||
%}{% assign prev = post | ||
%}{% endfor | ||
%} | ||
<div class="backnext {{ include.posclass }}"> | ||
{% include backnextnav.html %} | ||
</div> | ||
<script> | ||
document.body.onkeyup = function(e){ | ||
if (e.keyCode == '37') { window.location = '{{ prevurl }}'; } | ||
if (e.keyCode == '39') { window.location = '{{ nexturl }}'; } | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters