Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
theme: Swap sidebar order
See #2936
  • Loading branch information
bep committed Feb 26, 2025
commit efa6ff0943d7516d7eb5de52f028a60e4b1360c4
20 changes: 10 additions & 10 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@
{{ end }}

{{ define "rightsidebar_content" }}
{{/* in-this-section.html depends on these being reneredc first. */}}
{{ $related := partial "layouts/related.html" . }}
{{ $toc := partial "layouts/toc.html" . }}
{{ if not .Params.hide_in_this_section }}
{{ partial "layouts/in-this-section.html" . }}
{{ end }}
{{ $related }}
{{ if $.Store.Get "hasToc" }}
{{ $toc }}
{{ end }}
<div class="sticky top-[8rem] h-screen overflow-y-auto">
{{ $toc := partial "layouts/toc.html" . }}
{{ if $.Store.Get "hasToc" }}
{{ $toc }}
{{ end }}
{{ if not .Params.hide_in_this_section }}
{{ partial "layouts/in-this-section.html" . }}
{{ end }}
{{ partial "layouts/related.html" . }}
</div>
{{ end }}
7 changes: 1 addition & 6 deletions layouts/partials/layouts/in-this-section.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
{{- with .CurrentSection.RegularPages }}
{{ $hasTocOrRelated := or ($.Store.Get "hasToc") ($.Store.Get "hasRelated") }}
<div
class="overflow-y-auto {{ if $hasTocOrRelated }}
max-h-96
{{ else }}
sticky top-[8rem] max-h-[70vh]
{{ end }} relative mt-2 mb-8"
class="overflow-y-auto max-h-96 relative mt-6"
data-turbo-preserve-scroll-container="in-this-section">
<h2
class="text-base font-semibold tracking-tight text-gray-600 dark:text-gray-400">
Expand Down
3 changes: 1 addition & 2 deletions layouts/partials/layouts/related.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
{{/* Avoid repeating pages that's listed in In this section. */}}
{{- $related = $related | complement .CurrentSection.RegularPages | first 7 }}
{{- with $related }}
{{ $.Store.Set "hasRelated" true }}
<h2
class="text-base font-semibold tracking-tight text-gray-600 dark:text-gray-400">
class="text-base font-semibold tracking-tight text-gray-600 dark:text-gray-400 mt-8">
{{ $heading }}
</h2>
<ul class="mt-2 mb-8">
Expand Down
4 changes: 1 addition & 3 deletions layouts/partials/layouts/toc.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{{ with .Fragments.Headings }}
<div
x-data="toc"
class="sticky top-[8rem] h-screen overflow-y-auto overflow-x-hidden">
<div x-data="toc" class="overflow-x-hidden">
<h2
class="text-base font-semibold tracking-tight text-gray-600 dark:text-gray-400">
On this page
Expand Down