Skip to content

Commit

Permalink
I'm totally wrong it will work (#1144)
Browse files Browse the repository at this point in the history
this didn't work when I tried it before, but there's obviously something wrong in my pages model because it works now, and this is a much much smaller change
  • Loading branch information
SallyMcGrath authored Oct 29, 2024
1 parent d2d50e4 commit c5f5a91
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 27 deletions.
22 changes: 0 additions & 22 deletions common-theme/layouts/_default/sprint.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,4 @@ <h3 class="c-timeline__title">{{ .Title }}</h3>
{{ end }}
</ol>
</article>
<footer class="c-page-footer">
<nav class="c-page-footer__nav">
<!--These aren't quite sections so prev and next won't appear, but we can fake it-->
{{ $thisPageWeight := .Page.Weight }}
{{ $PrevInSection := .Page.Parent }}
{{ $NextInSection := .Page.Parent }}
{{ range where .Site.Pages "Section" .Section }}
{{ if and (in .Params.menu_level "module") (eq .Weight (sub $thisPageWeight 1)) }}
{{ $PrevInSection = . }}
{{ end }}
{{ if and (in .Params.menu_level "module") (eq .Weight (add $thisPageWeight 1)) }}
{{ $NextInSection = . }}
{{ end }}
{{ end }}

<a href="{{ $PrevInSection.RelPermalink }}"
>{{ $PrevInSection.Title }}</a
>
<a href="{{ $NextInSection.RelPermalink }}">{{ $NextInSection.Title }}</a
>
</nav>
</footer>
{{ end }}
10 changes: 5 additions & 5 deletions common-theme/layouts/partials/page-footer.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{{/* Section navigation */}}

{{ if or .PrevInSection .NextInSection }}
{{/* Section navigation and other tiny tips */}}
{{ if or .IsSection .IsPage }}
<footer class="c-page-footer">
<nav class="c-page-footer__nav">
{{ with .PrevInSection }}
{{ $pages := .Page.Parent.Pages.Reverse }}
{{ with $pages.Prev . }}
<a
class="c-page-footer__prev c-page-footer__link e-link"
href="{{ .RelPermalink }}"
>{{ .Title }}</a
>
{{ end }}
<span class="c-page-footer__this">{{ .Title }}</span>
{{ with .NextInSection }}
{{ with $pages.Next . }}
<a
class="c-page-footer__next c-page-footer__link e-link"
href="{{ .RelPermalink }}"
Expand Down

0 comments on commit c5f5a91

Please sign in to comment.