Skip to content

Commit

Permalink
make prev next links consistent on themes single Ref #21
Browse files Browse the repository at this point in the history
  • Loading branch information
Bud Parr committed May 27, 2017
1 parent e61bb69 commit 2b35ff3
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions layouts/partials/previous-next-links.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
{{if .NextInSection}}
<a href="{{.NextInSection.Permalink }}" class="db-l f4 f3-ns link primary-color hover-black fw8">
{{ .NextInSection.Title }} <span class="v-mid dib">{{ partial "svg/ic_chevron_left_black_24px.svg" (dict "size" "30px") }}</span>
{{if .Prev }}
<a href="{{ .Prev.Permalink }}" class="db-l f4 f3-ns link primary-color hover-black fw8">
<span class="v-mid dib">{{ partial "svg/ic_chevron_left_black_24px.svg" (dict "size" "30px") }}</span> {{ .Prev.Title }}
</a>
{{end}}

{{if .PrevInSection}}
<a href="{{ .PrevInSection.Permalink }}" class="db-l f4 f3-ns link primary-color hover-black fw8">
<span class="v-mid dib">{{ partial "svg/ic_chevron_right_black_24px.svg" (dict "size" "30px") }}</span> {{ .PrevInSection.Title }}
{{if .Next }}
<a href="{{.Next.Permalink }}" class="db-l f4 f3-ns link primary-color hover-black fw8">
{{ .Next.Title }} <span class="v-mid dib">{{ partial "svg/ic_chevron_right_black_24px.svg" (dict "size" "30px") }}</span>
</a>
{{end}}


<script>
document.body.onkeyup = function(e){

{{ if .PrevInSection }}
if (e.keyCode == '39') { window.location = '{{ .PrevInSection.Permalink }}'; }
{{ if .Prev }}
if (e.keyCode == '37') { window.location = '{{ .Prev.Permalink }}'; }
{{ end }}
{{ if .NextInSection }}
if (e.keyCode == '37') { window.location = '{{.NextInSection.Permalink }}'; }
{{ if .Next }}
if (e.keyCode == '39') { window.location = '{{.Next.Permalink }}'; }
{{ end }}
};

Expand Down

0 comments on commit 2b35ff3

Please sign in to comment.