hugo: refactor sidebar templates

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
David Karlsson 2024-09-17 10:11:09 +02:00
parent 7f321a9197
commit 5eb0381ef1
17 changed files with 20 additions and 40 deletions

View File

@ -394,7 +394,6 @@
"mt-1",
"mt-2",
"mt-20",
"mt-4",
"mx-auto",
"my-0",
"my-2",

View File

@ -24,6 +24,8 @@
</button>
<!-- Actual Sidebar Content -->
{{ block "left" . }}
{{ partial "sidebar/mainnav.html" . }}
{{ partial "sidebar/sections.html" . }}
{{ end }}
</div>
</div>

View File

@ -1,7 +1,3 @@
{{ define "left" }}
{{ partial "sidebar.html" . }}
{{ end }}
{{ define "main" }}
{{ $data := "" }}
{{ if .Params.datafolder }}

View File

@ -1,5 +1,5 @@
{{ define "left" }}
{{ partial "sidebar.html" . }}
{{ partial "sidebar/mainnav.html" . }}
{{ end }}
{{ define "main" }}

View File

@ -1,7 +1,3 @@
{{ define "left" }}
{{ partial "sidebar.html" . }}
{{ end }}
{{ define "main" }}
{{ partial "content-default.html" . }}
{{ end }}

View File

@ -1,5 +1,5 @@
{{ define "left" }}
{{ partial "sidebar.html" . }}
{{ partial "sidebar/mainnav.html" . }}
{{ end }}
{{ define "main" }}

View File

@ -1,7 +1,3 @@
{{ define "left" }}
{{ partial "sidebar.html" . }}
{{ end }}
{{ define "main" }}
{{ partial "breadcrumbs.html" . }}
<article class="prose max-w-none dark:prose-invert">

View File

@ -1,7 +1,3 @@
{{ define "left" }}
{{ partial "sidebar.html" . }}
{{ end }}
{{ define "main" }}
{{ partial "content-default.html" . }}
{{ end }}

View File

@ -1,9 +1,5 @@
{{ define "left" }}
{{ partial "sidebar.html" . }}
{{ end }}
{{ define "main" }}
<article class="prose min-w-0 flex-[2_2_0%] max-w-4xl dark:prose-invert">
<article class="prose min-w-0 flex-[2_2_0%] max-w-4xl dark:prose-invert">
{{ partial "breadcrumbs.html" . }}
<h1 data-pagefind-weight="10" class="scroll-mt-36">{{ .Title }}</h1>
{{ if eq .CurrentSection.Layout "series" }}

View File

@ -1,7 +1,3 @@
{{ define "left" }}
{{- partial "sidebar.html" . }}
{{ end }}
{{ define "main" }}
<article class="prose max-w-none dark:prose-invert">
{{ partial "breadcrumbs.html" . }}

View File

@ -12,7 +12,3 @@
{{ partial "post-links.html" (where .CurrentSection.Pages "Permalink" "ne" page.Permalink) }}
</article>
{{ end }}
{{ define "left" }}
{{- partial "sidebar.html" . }}
{{ end }}

View File

@ -1,13 +1,20 @@
<!-- Main navigation for the sidebar -->
<div class="py-2 px-4" x-data="{ expanded: false }">
<div class="flex w-full items-center justify-between">
<a class="hover:text-blue-light dark:hover:text-blue-dark" href="{{ .FirstSection.Permalink }}">
{{- with .FirstSection.Params.icon }}
<!-- Current section: use menu, fall back to current page -->
{{- $curr := page }}
{{- range site.Menus.main }}
{{- if .Page.IsAncestor page }}
{{- $curr = .Page }}
{{- end }}
{{- end }}
<a class="hover:text-blue-light dark:hover:text-blue-dark" href="{{ $curr.Permalink }}">
{{- with $curr.Params.icon }}
<span class="pr-2 icon-sm icon-svg">
{{- partialCached "icon.html" . . -}}
</span>
{{- end }}
{{- .FirstSection.LinkTitle -}}
{{- $curr.LinkTitle -}}
</a>
<button @click="expanded = !expanded" class="rounded hover:bg-gray-light-300 hover:dark:bg-gray-dark-300">
<span x-show="! expanded" class="icon-svg">

View File

@ -1,6 +1,4 @@
<!-- section tree -->
{{ partial "sidebar-mainnav.html" . }}
<nav class="md:text-sm flex flex-col">
<div
class="block py-4 md:hidden text-gray-light dark:text-gray-dark">This section</div>

View File

@ -1,5 +1,6 @@
{{ define "left" }}
{{ partial "sidebar.html" . }}
{{ partial "sidebar/mainnav.html" . }}
{{ partial "sidebar/sections.html" . }}
{{ end }}
{{ define "main" }}

View File

@ -1,5 +1,6 @@
{{ define "left" }}
{{ partial "sidebar-tags.html" . }}
{{ partial "sidebar/mainnav.html" . }}
{{ partial "sidebar/tags.html" . }}
{{ end }}
{{ define "main" }}

View File

@ -1,5 +1,5 @@
{{ define "left" }}
{{ partial "sidebar-tags.html" . }}
{{ partial "sidebar/tags.html" . }}
{{ end }}
{{ define "main" }}