Compare commits

..

3 Commits

Author SHA1 Message Date
f677a3731c Add a series nav shortcode to display navigation early
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-06-19 22:03:33 -07:00
a8549922c3 Trim more whitespace from template
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-06-19 21:57:25 -07:00
db9433bda1 Extract series navigation into a partial
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-06-19 21:56:00 -07:00
4 changed files with 34 additions and 26 deletions

View File

@ -424,3 +424,7 @@ blockquote {
margin-left: 0; margin-left: 0;
padding-left: 1rem; padding-left: 1rem;
} }
.early-navigation-wrapper {
margin-bottom: 3rem;
}

View File

@ -2,44 +2,32 @@
<h2>{{ .Title }}</h2> <h2>{{ .Title }}</h2>
<div class="post-subscript"> <div class="post-subscript">
<p> <p>
{{ range .Params.tags }} {{- range .Params.tags -}}
<a class="button" href="{{ $.Site.BaseURL }}/tags/{{ . | urlize }}">{{ . }}</a> <a class="button" href="{{ $.Site.BaseURL }}/tags/{{ . | urlize }}">{{ . }}</a>
{{ end }} {{- end -}}
</p> </p>
<p>{{ i18n "postedOn" (.Date.Format "January 2, 2006") }}.</p> <p>{{ i18n "postedOn" (.Date.Format "January 2, 2006") }}.</p>
</div> </div>
<div class="post-content"> <div class="post-content">
{{ if not (eq .TableOfContents "<nav id=\"TableOfContents\"></nav>") }} {{- if not (eq .TableOfContents "<nav id=\"TableOfContents\"></nav>") -}}
<div class="table-of-contents"> <div class="table-of-contents">
<div class="wrapper"> <div class="wrapper">
<em>{{ i18n "tableOfContents" }}</em> <em>{{- i18n "tableOfContents" -}}</em>
{{ .TableOfContents }} {{- .TableOfContents -}}
</div> </div>
</div> </div>
{{ end }} {{- end -}}
{{ if .Draft }} {{- if .Draft -}}
{{ partial "warning.html" (i18n "postDraft") }} {{- partial "warning.html" (i18n "postDraft") -}}
{{ end }} {{- end -}}
{{ .Content }} {{- .Content -}}
</div> </div>
{{ end }} {{- end -}}
{{ define "after" }} {{- define "after" -}}
{{ $term := index (.GetTerms "series") 0 }} {{- partial "seriesnav.html" . -}}
{{ with $term }}
{{- /* No idea why the 'Reverse' is needed? */ -}}
{{ $pages := (site.Taxonomies.series.Get .Data.Term).Pages.ByDate.Reverse }}
<nav id="SeriesNavigation" class="container">
{{ with $pages.Prev page }}
{{ partial "serieslink.html" (dict "direction" "previous" "link" .RelPermalink "page" .) }}
{{ end }}
{{ with $pages.Next page }}
{{ partial "serieslink.html" (dict "direction" "next" "link" .RelPermalink "page" .) }}
{{ end }}
</nav>
{{ end }}
<hr class="container footer-divider"> <hr class="container footer-divider">
<footer class="container"> <footer class="container">
<p>{{ i18n "contactFooter" | safeHTML }}</p> <p>{{ i18n "contactFooter" | safeHTML }}</p>
@ -51,4 +39,4 @@
to learn more about me!</p> to learn more about me!</p>
--> -->
</footer> </footer>
{{ end }} {{- end -}}

View File

@ -0,0 +1,13 @@
{{ $term := index (.GetTerms "series") 0 }}
{{ with $term }}
{{- /* No idea why the 'Reverse' is needed? */ -}}
{{ $pages := (site.Taxonomies.series.Get .Data.Term).Pages.ByDate.Reverse }}
<nav id="SeriesNavigation" class="container">
{{ with $pages.Prev page }}
{{ partial "serieslink.html" (dict "direction" "previous" "link" .RelPermalink "page" .) }}
{{ end }}
{{ with $pages.Next page }}
{{ partial "serieslink.html" (dict "direction" "next" "link" .RelPermalink "page" .) }}
{{ end }}
</nav>
{{ end }}

View File

@ -0,0 +1,3 @@
<div class="early-navigation-wrapper">
{{ partial "seriesnav.html" .Page }}
</div>