[new feature] TOC folding option
This commit is contained in:
		
							parent
							
								
									48b4144bb1
								
							
						
					
					
						commit
						80f7a5c6bc
					
				|  | @ -280,6 +280,7 @@ enableListSidebarTitles = true | |||
| enableToc = true # single page table of contents, you can replace this param to toc(toc = true) | ||||
| hideToc = false # Hide or Show toc | ||||
| tocPosition = "inner" # inner, outer | ||||
| tocFolding = false | ||||
| enableTocSwitch = true # single page table of contents visibility switch | ||||
| itemsPerCategory = 5 # maximum number of posts shown in the sidebar. | ||||
| sidebarPosition = "right" # bio, profile component layout position | ||||
|  |  | |||
|  | @ -271,6 +271,7 @@ enableListSidebarTitles = true | |||
| enableToc = true # single page table of contents, you can replace this param to toc(toc = true) | ||||
| hideToc = false # Hide or Show toc | ||||
| tocPosition = "inner" # inner, outer | ||||
| tocFolding = false | ||||
| enableTocSwitch = true # single page table of contents visibility switch | ||||
| itemsPerCategory = 5 # maximum number of posts shown in the sidebar. | ||||
| sidebarPosition = "right" # bio, profile component layout position | ||||
|  |  | |||
|  | @ -76,62 +76,137 @@ | |||
|   } | ||||
| 
 | ||||
|   &[data-dir="ltr"] { | ||||
|     a { | ||||
|       color: inherit;      | ||||
|       position: relative; | ||||
|       &::before { | ||||
|         @include themify($themes) {         | ||||
|           background-color: themed('toc-vertical-line'); | ||||
|         }       | ||||
|         content: ''; | ||||
|         height: 100%; | ||||
|         left: -1rem; | ||||
|         margin-top: -1px; | ||||
|         position: absolute; | ||||
|         width: 2px;             | ||||
|         &:last-child { | ||||
|           background-color: transparent; | ||||
|     &[data-folding=true] { | ||||
|       @include themify($themes) { | ||||
|         a { | ||||
|           color: themed('toc-vertical-line'); | ||||
|           position: relative; | ||||
| 
 | ||||
|           &::before { | ||||
|             content: ''; | ||||
|             height: 100%; | ||||
|             left: -1rem; | ||||
|             margin-top: -1px; | ||||
|             position: absolute; | ||||
|             width: 2px;             | ||||
|             background-color: themed('toc-vertical-line'); | ||||
|             &:last-child { | ||||
|               background-color: transparent; | ||||
|             } | ||||
|           } | ||||
|         } | ||||
|            | ||||
|         .active { | ||||
|           color: themed('toc-vertical-line-active'); | ||||
|           font-weight: 700; | ||||
|           &::before { | ||||
|             background-color: themed('toc-vertical-line-active'); | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|      | ||||
|     .active { | ||||
| 
 | ||||
|     &[data-folding=false] { | ||||
|       @include themify($themes) { | ||||
|         color: themed('link-hover'); | ||||
|         font-weight: 700; | ||||
|         &::before {         | ||||
|           background-color: themed('toc-vertical-line-active'); | ||||
|         a { | ||||
|           color: themed('toc-vertical-line'); | ||||
| 
 | ||||
|           &.active { | ||||
|             color: themed('toc-vertical-line-active'); | ||||
|              | ||||
|             &::before { | ||||
|               background-color: themed('toc-vertical-line-active'); | ||||
|               content: ''; | ||||
|               height: 0.95rem; | ||||
|               left: -1rem; | ||||
|               margin-top: 2px; | ||||
|               position: absolute; | ||||
|               width: 2px;             | ||||
|               &:last-child { | ||||
|                 background-color: transparent; | ||||
|               } | ||||
|             } | ||||
|           } | ||||
|         }    | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     ul { | ||||
|       @include themify($themes) { | ||||
|         li {         | ||||
|           li { | ||||
|             margin-left: 1rem; | ||||
|             color: themed('sidebar-li-color');       | ||||
|           }   | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   &[data-dir="rtl"] { | ||||
|     a { | ||||
|       color: inherit;      | ||||
|       position: relative; | ||||
|       &::before { | ||||
|         @include themify($themes) {         | ||||
|           background-color: themed('toc-vertical-line'); | ||||
|         }       | ||||
|         content: ''; | ||||
|         height: 100%; | ||||
|         right: -1rem; | ||||
|         margin-top: -1px; | ||||
|         position: absolute; | ||||
|         width: 2px;             | ||||
|         &:last-child { | ||||
|           background-color: transparent; | ||||
|     &[data-folding=true] { | ||||
|       a { | ||||
|         color: inherit; | ||||
|         position: relative; | ||||
|         &::before { | ||||
|           @include themify($themes) {         | ||||
|             background-color: themed('toc-vertical-line'); | ||||
|           }       | ||||
|           content: ''; | ||||
|           height: 100%; | ||||
|           right: -1rem; | ||||
|           margin-top: -1px; | ||||
|           position: absolute; | ||||
|           width: 2px;             | ||||
|           &:last-child { | ||||
|             background-color: transparent; | ||||
|           } | ||||
|         } | ||||
|       } | ||||
| 
 | ||||
|       .active { | ||||
|         @include themify($themes) { | ||||
|           color: themed('link-hover'); | ||||
|           font-weight: 700; | ||||
|           &::before {         | ||||
|             background-color: themed('toc-vertical-line-active'); | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     .active { | ||||
|     &[data-folding=false] { | ||||
|       @include themify($themes) { | ||||
|         color: themed('link-hover'); | ||||
|         font-weight: 700; | ||||
|         &::before {         | ||||
|           background-color: themed('toc-vertical-line-active'); | ||||
|         a { | ||||
|           color: themed('toc-vertical-line'); | ||||
| 
 | ||||
|           &.active { | ||||
|             color: themed('toc-vertical-line-active'); | ||||
|              | ||||
|             &::before { | ||||
|               background-color: themed('toc-vertical-line-active'); | ||||
|               content: ''; | ||||
|               height: 0.95rem; | ||||
|               right: -1rem; | ||||
|               margin-top: 2px; | ||||
|               position: absolute; | ||||
|               width: 2px;             | ||||
|               &:last-child { | ||||
|                 background-color: transparent; | ||||
|               } | ||||
|             } | ||||
|           } | ||||
|         }    | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     ul { | ||||
|       @include themify($themes) { | ||||
|         li { | ||||
|           li { | ||||
|             margin-right: 1rem; | ||||
|             color: themed('sidebar-li-color');       | ||||
|           }   | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|  | @ -139,13 +214,6 @@ | |||
| 
 | ||||
|   ul { | ||||
|     @include themify($themes) { | ||||
|       li {         | ||||
|         li { | ||||
|           margin-left: 1rem; | ||||
|           color: themed('sidebar-li-color');       | ||||
|         }   | ||||
|       } | ||||
|        | ||||
|       a { | ||||
|         color: themed('toc-title-color');         | ||||
|         &.active { | ||||
|  |  | |||
|  | @ -47,6 +47,7 @@ enableHomeSidebarTitles = true | |||
| enableListSidebarTitles = true | ||||
| enableToc = true | ||||
| hideToc = false | ||||
| tocFolding = true | ||||
| tocPosition = "inner" # inner, outer | ||||
| enableTocSwitch = true | ||||
| itemsPerCategory = 5 | ||||
|  |  | |||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							|  | @ -1,7 +1,7 @@ | |||
| {{ define "main" }} | ||||
| 
 | ||||
| <main class="main inner" data-sidebar-position="{{ $.Param "sidebarPosition" }}"> | ||||
|     <div class="list__main {{ if $.Param "enableSidebar" }}{{ if eq .Site.Params.sidebarPosition "left" }}mr{{ else }}lm{{ end }}{{ else }}lmr{{ end }}"> | ||||
|     <div class="list__main {{ if $.Param "enableSidebar" }}{{ if eq ($.Param "sidebarPosition") "left" }}mr{{ else }}lm{{ end }}{{ else }}lmr{{ end }}"> | ||||
|         {{ partial "body/breadcrumb" . }} | ||||
|         <header class="list__header"> | ||||
|             <h5 class="list__header--title capitalize h5">{{.Title}}</h5> | ||||
|  | @ -21,16 +21,16 @@ | |||
|     </div>     | ||||
| 
 | ||||
|     {{ if $.Param "enableSidebar" }} | ||||
|         <aside class="list__sidebar {{ if eq .Site.Params.sidebarPosition "left" }}l{{ else }}r{{ end }}" data-dir="{{ $.Param "languagedir" | default "ltr" }}"> | ||||
|         <aside class="list__sidebar {{ if eq ($.Param "sidebarPosition") "left" }}l{{ else }}r{{ end }}" data-dir="{{ $.Param "languagedir" | default "ltr" }}"> | ||||
|             {{ partial "sidebar/sidebar-list" . }} | ||||
|         </aside> | ||||
|     {{ end }} | ||||
| </main> | ||||
| 
 | ||||
| <script> | ||||
|     {{ $sidebarPosition:= .Site.Params.sidebarPosition }} | ||||
|     {{ $sidebarPosition:= $.Param "sidebarPosition" }} | ||||
|     var sidebarPosition = JSON.parse({{ $sidebarPosition | jsonify }}); | ||||
|     {{ $enableSidebar:= .Site.Params.enableSidebar }} | ||||
|     {{ $enableSidebar:= $.Param "enableSidebar" }} | ||||
|     var enableSidebar = JSON.parse({{ $enableSidebar | jsonify }}); | ||||
| 
 | ||||
|     var listMainElem = document.querySelector('.list__main'); | ||||
|  |  | |||
|  | @ -1,8 +1,8 @@ | |||
| {{ define "main" }} | ||||
| 
 | ||||
| <main class="single__main {{ if or ($.Param "enableToc") ($.Param "toc") }}{{ if $.Param "hideToc" }}main{{ else if eq ($.Param "tocPosition") "outer" }}main{{ else }}main-main{{ end }}{{ else }}main{{ end }}"> | ||||
|   {{ if eq .Site.Params.enableBreadcrumb true }} | ||||
|   {{ partial "body/breadcrumb" . }} | ||||
|   {{ if $.Param "enableBreadcrumb" }} | ||||
|     {{ partial "body/breadcrumb" . }} | ||||
|   {{ end }} | ||||
|   <div class="single"> | ||||
|     <h2 class="single__title">{{ .Title }}</h2> | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| {{ define "main" }} | ||||
| 
 | ||||
| <main class="main inner" data-sidebar-position="{{ $.Param "sidebarPosition" }}"> | ||||
|   <div class="list__main {{ if $.Param "enableSidebar" }}{{ if eq .Site.Params.sidebarPosition "left" }}mr{{ else }}lm{{ end }}{{ else }}lmr{{ end }}"> | ||||
|   <div class="list__main {{ if $.Param "enableSidebar" }}{{ if eq ($.Param "sidebarPosition") "left" }}mr{{ else }}lm{{ end }}{{ else }}lmr{{ end }}"> | ||||
|     {{ partial "body/breadcrumb" . }} | ||||
|     <header class="list__header"> | ||||
|       <h5 class="list__header--title capitalize h5">{{ .Title }}</h5> | ||||
|  | @ -20,16 +20,16 @@ | |||
|   </div> | ||||
| 
 | ||||
|   {{ if $.Param "enableSidebar" }} | ||||
|     <aside class="list__sidebar {{ if eq .Site.Params.sidebarPosition "left" }}l{{ else }}r{{ end }}" data-dir="{{ $.Param "languagedir" | default "ltr" }}"> | ||||
|     <aside class="list__sidebar {{ if eq ($.Param "sidebarPosition") "left" }}l{{ else }}r{{ end }}" data-dir="{{ $.Param "languagedir" | default "ltr" }}"> | ||||
|       {{ partial "sidebar/sidebar-list" . }} | ||||
|     </aside> | ||||
|   {{ end }} | ||||
| </main> | ||||
| 
 | ||||
| <script> | ||||
|   {{ $sidebarPosition:= .Site.Params.sidebarPosition }} | ||||
|   {{ $sidebarPosition:= $.Param "sidebarPosition" }} | ||||
|   var sidebarPosition = JSON.parse({{ $sidebarPosition | jsonify }}); | ||||
|   {{ $enableSidebar:= .Site.Params.enableSidebar }} | ||||
|   {{ $enableSidebar:= $.Param "enableSidebar" }} | ||||
|   var enableSidebar = JSON.parse({{ $enableSidebar | jsonify }}); | ||||
| 
 | ||||
|   var listMainElem = document.querySelector('.list__main'); | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| {{ define "main" }} | ||||
| {{ $titleWrap := .Params.titleWrap }} | ||||
| {{ $titleWrap := $.Param "titleWrap" }} | ||||
| 
 | ||||
| <header class="header"> | ||||
|   <h3 class="h3 terms__title"> | ||||
|  | @ -12,11 +12,11 @@ | |||
| <main class="main archive"> | ||||
|   <div class="archive__container"> | ||||
|     {{ $filteredPages := .Site.RegularPages }} | ||||
|     {{ range .Site.Params.notAllowedTypesInArchive }} | ||||
|     {{ range $.Param "notAllowedTypesInArchive" }} | ||||
|       {{ $filteredPages = (where $filteredPages "Type" "!=" (lower .)) }} | ||||
|     {{ end }} | ||||
| 
 | ||||
|     {{ $paginator := .Paginate ($filteredPages.GroupByDate (.Site.Params.archiveGroupByDate | default "2006")) .Site.Params.archivePaginate }} | ||||
|     {{ $paginator := .Paginate ($filteredPages.GroupByDate ($.Param "archiveGroupByDate" | default "2006")) ($.Param "archivePaginate") }} | ||||
|      | ||||
|     {{ range ($paginator).PageGroups }} | ||||
|     <span class="archive__key">{{ .Key }}</span> | ||||
|  |  | |||
|  | @ -3,10 +3,10 @@ | |||
| {{ define "main" }} | ||||
| 
 | ||||
| <main class="main inner" data-sidebar-position="{{ $.Param "sidebarPosition" }}"> | ||||
|     <div class="list__main {{ if $.Param "enableSidebar" }}{{ if eq .Site.Params.sidebarPosition "left" }}mr{{ else }}lm{{ end }}{{ else }}lmr{{ end }}"> | ||||
|     <div class="list__main {{ if $.Param "enableSidebar" }}{{ if eq ($.Param "sidebarPosition") "left" }}mr{{ else }}lm{{ end }}{{ else }}lmr{{ end }}"> | ||||
|         <div class="summary__container"> | ||||
|             {{ $filteredPages := .Site.RegularPages }} | ||||
|             {{ range .Site.Params.notAllowedTypesInHome }} | ||||
|             {{ range $.Param "notAllowedTypesInHome" }} | ||||
|                 {{ $filteredPages = (where $filteredPages "Type" "!=" (lower .)) }} | ||||
|             {{ end }} | ||||
|             {{ $paginator := .Paginate $filteredPages }} | ||||
|  | @ -19,15 +19,15 @@ | |||
|     </div> | ||||
| 
 | ||||
|     {{ if $.Param "enableSidebar" }} | ||||
|         <aside class="list__sidebar {{ if eq .Site.Params.sidebarPosition "left" }}l{{ else }}r{{ end }}" data-dir="{{ $.Param "languagedir" | default "ltr" }}"> | ||||
|         <aside class="list__sidebar {{ if eq ($.Param "sidebarPosition") "left" }}l{{ else }}r{{ end }}" data-dir="{{ $.Param "languagedir" | default "ltr" }}"> | ||||
|             {{ partial "sidebar/sidebar-home" . }} | ||||
|         </aside> | ||||
|     {{ end }} | ||||
| </main> | ||||
| <script> | ||||
|     {{ $sidebarPosition:= .Site.Params.sidebarPosition }} | ||||
|     {{ $sidebarPosition:= $.Param "sidebarPosition" }} | ||||
|     var sidebarPosition = JSON.parse({{ $sidebarPosition | jsonify }}); | ||||
|     {{ $enableSidebar:= .Site.Params.enableSidebar }} | ||||
|     {{ $enableSidebar:= $.Param "enableSidebar" }} | ||||
|     var enableSidebar = JSON.parse({{ $enableSidebar | jsonify }}); | ||||
|      | ||||
|     var listMainElem = document.querySelector('.list__main'); | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ | |||
|           </label> | ||||
|           {{ end }} | ||||
|         </div> | ||||
|         <div class="toc toc__outer {{ if $.Param "hideToc" }}hide{{ end }}" data-dir="rtl"> | ||||
|         <div class="toc toc__outer {{ if $.Param "hideToc" }}hide{{ end }}" data-dir="rtl" data-folding="{{ if $.Param "tocFolding" }}true{{ else }}false{{ end }}"> | ||||
|           {{ .TableOfContents }} | ||||
|         </div> | ||||
|       {{ end }} | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ | |||
|           </label> | ||||
|           {{ end }} | ||||
|         </div> | ||||
|         <div class="toc toc__outer {{ if $.Param "hideToc" }}hide{{ end }}" data-dir="ltr"> | ||||
|         <div class="toc toc__outer {{ if $.Param "hideToc" }}hide{{ end }}" data-dir="ltr" data-folding="{{ if $.Param "tocFolding" }}true{{ else }}false{{ end }}"> | ||||
|           {{ .TableOfContents }} | ||||
|         </div> | ||||
|       {{ end }} | ||||
|  |  | |||
|  | @ -202,6 +202,9 @@ | |||
|     var boxContents = document.querySelectorAll('.box'); | ||||
|     var notAllowedTitleIds = null; | ||||
| 
 | ||||
|     {{ $tocFolding := $.Param "tocFolding" }} | ||||
|     var tocFolding = JSON.parse({{ $tocFolding | jsonify }}); | ||||
| 
 | ||||
|     // tab | ||||
|     singleContentsElem && singleContentsElem.querySelectorAll(".tab") ? | ||||
|     singleContentsElem.querySelectorAll(".tab").forEach(function (elem) { | ||||
|  | @ -272,14 +275,18 @@ | |||
|                   tocElem.querySelector('a[href="#' + id + '"]') ? | ||||
|                     tocElem.querySelector('a[href="#' + id + '"]').classList.add('active') : null; | ||||
| 
 | ||||
|                   tableOfContentsElem.querySelectorAll('ul') ?  | ||||
|                   tableOfContentsElem.querySelectorAll('ul').forEach(function (rootUl) { | ||||
|                     rootUl.querySelectorAll('li').forEach(function (liElem) { | ||||
|                       liElem.querySelectorAll('ul').forEach(function (ulElem) { | ||||
|                         ulElem.style.display = 'none'; | ||||
|                       }); | ||||
|                     }); | ||||
|                   }) : null; | ||||
|                   if (false === tocFolding) { | ||||
|                      | ||||
|                   } else { | ||||
|                     tableOfContentsElem.querySelectorAll('ul') ? | ||||
|                       tableOfContentsElem.querySelectorAll('ul').forEach(function (rootUl) { | ||||
|                         rootUl.querySelectorAll('li').forEach(function (liElem) { | ||||
|                           liElem.querySelectorAll('ul').forEach(function (ulElem) { | ||||
|                             ulElem.style.display = 'none'; | ||||
|                           }); | ||||
|                         }); | ||||
|                       }) : null; | ||||
|                   } | ||||
| 
 | ||||
|                   var curElem = tableOfContentsElem.querySelector("[href='#" + id + "']"); | ||||
|                   if (curElem && curElem.nextElementSibling) { | ||||
|  | @ -338,14 +345,18 @@ | |||
|                   tocElem.querySelector('a[href="#' + id + '"]') ? | ||||
|                     tocElem.querySelector('a[href="#' + id + '"]').classList.add('active') : null; | ||||
| 
 | ||||
|                   tableOfContentsElem.querySelectorAll('ul') ?  | ||||
|                   tableOfContentsElem.querySelectorAll('ul').forEach(function (rootUl) { | ||||
|                     rootUl.querySelectorAll('li').forEach(function (liElem) { | ||||
|                       liElem.querySelectorAll('ul').forEach(function (ulElem) { | ||||
|                         ulElem.style.display = 'none'; | ||||
|                       }); | ||||
|                     }); | ||||
|                   }) : null; | ||||
|                   if (false === tocFolding) { | ||||
|                      | ||||
|                   } else { | ||||
|                     tableOfContentsElem.querySelectorAll('ul') ? | ||||
|                       tableOfContentsElem.querySelectorAll('ul').forEach(function (rootUl) { | ||||
|                         rootUl.querySelectorAll('li').forEach(function (liElem) { | ||||
|                           liElem.querySelectorAll('ul').forEach(function (ulElem) { | ||||
|                             ulElem.style.display = 'none'; | ||||
|                           }); | ||||
|                         }); | ||||
|                       }) : null; | ||||
|                   } | ||||
| 
 | ||||
|                   var curElem = tableOfContentsElem.querySelector("[href='#" + id + "']"); | ||||
|                   if (curElem && curElem.nextElementSibling) { | ||||
|  | @ -370,12 +381,16 @@ | |||
|         } | ||||
| 
 | ||||
|         if (tableOfContentsElem && document.documentElement.scrollTop < 250) { | ||||
|           tableOfContentsElem.querySelector('ul') ? | ||||
|           tableOfContentsElem.querySelector('ul').querySelectorAll('li').forEach(function (liElem) { | ||||
|             liElem.querySelectorAll('ul').forEach(function (ulElem) { | ||||
|               ulElem.style.display = 'none'; | ||||
|             }); | ||||
|           }) : null; | ||||
|           if (false === tocFolding) { | ||||
| 
 | ||||
|           } else { | ||||
|             tableOfContentsElem.querySelector('ul') ? | ||||
|               tableOfContentsElem.querySelector('ul').querySelectorAll('li').forEach(function (liElem) { | ||||
|                 liElem.querySelectorAll('ul').forEach(function (ulElem) { | ||||
|                   ulElem.style.display = 'none'; | ||||
|                 }); | ||||
|               }) : null; | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|       lastScrollTop = st <= 0 ? 0 : st; | ||||
|  |  | |||
|  | @ -1,10 +1,10 @@ | |||
| {{ if .IsHome }} | ||||
| <header class="header"> | ||||
|     {{ if and .Site.Params.homeHeaderType (eq .Site.Params.homeHeaderType "slide") }} | ||||
|     {{ if and ($.Param "homeHeaderType") (eq ($.Param "homeHeaderType") "slide") }} | ||||
|         {{ partial "header/header-slide" . }} | ||||
|     {{ else if and .Site.Params.homeHeaderType (eq .Site.Params.homeHeaderType "img") }} | ||||
|     {{ else if and ($.Param "homeHeaderType") (eq ($.Param "homeHeaderType") "img") }} | ||||
|         {{ partial "header/header-img" . }} | ||||
|     {{ else if and .Site.Params.homeHeaderType (eq .Site.Params.homeHeaderType "text") }} | ||||
|     {{ else if and ($.Param "homeHeaderType") (eq ($.Param "homeHeaderType") "text") }} | ||||
|         {{ partial "header/header-text" . }} | ||||
|     {{ else }} | ||||
|         {{ partial "header/custom-header" . }} | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| {{ if $.Param "enableThemeChange" }} | ||||
| <div class="theme-mobile"> | ||||
|   <div class="dropdown"> | ||||
|     <button class="dropdown-trigger navbar__slide-down" aria-label="Select Theme Button" style="{{ if .Site.Params.enableSearch }}{{ else }}position: absolute; top: 0;{{ end }}"> | ||||
|     <button class="dropdown-trigger navbar__slide-down" aria-label="Select Theme Button" style="{{ if $.Param "enableSearch" }}{{ else }}position: absolute; top: 0;{{ end }}"> | ||||
|       {{ partial "svgs/etc/invert-colors.svg" (dict "width" 22 "height" 22) }}       | ||||
|     </button> | ||||
|     <div class="dropdown-content select-theme"> | ||||
|  |  | |||
|  | @ -2,8 +2,8 @@ | |||
| <script defer src="{{ $shave.RelPermalink }}"></script> | ||||
| 
 | ||||
| <script> | ||||
|   {{ $enableBio:= .Params.enableBio }} | ||||
|   {{ $sidebarPosition:= .Site.Params.sidebarPosition }} | ||||
|   {{ $enableBio:= $.Param "enableBio" }} | ||||
|   {{ $sidebarPosition:= $.Param "sidebarPosition" }} | ||||
|   var enableBio = JSON.parse({{ $enableBio | jsonify }}); | ||||
|   var sidebarPosition = JSON.parse({{ $sidebarPosition | jsonify }}); | ||||
| 
 | ||||
|  |  | |||
|  | @ -135,23 +135,30 @@ | |||
|     {{ $enableToc := ($.Param "enableToc") }} | ||||
|     {{ $toc := ($.Param "toc") }} | ||||
|     {{ $hideToc := ($.Param "hideToc") }} | ||||
|     {{ $tocFolding := $.Param "tocFolding" }} | ||||
|      | ||||
|     var enableToc = JSON.parse({{ $enableToc | jsonify }}); | ||||
|     var toc = JSON.parse({{ $toc | jsonify }}); | ||||
|     var hideToc = JSON.parse({{ $hideToc | jsonify }}); | ||||
|     var tocFlexbox = document.querySelector('.toc__flexbox'); | ||||
|     var tocFlexboxOuter = document.querySelector('.toc__flexbox--outer'); | ||||
|     var tocFolding = JSON.parse({{ $tocFolding | jsonify }}); | ||||
|      | ||||
|     if ((enableToc || toc) && document.querySelector('.toc')) { | ||||
|       var tableOfContentsElem = document.querySelector('.toc').querySelector('#TableOfContents'); | ||||
|       tableOfContentsElem.querySelectorAll('ul') ? | ||||
|       tableOfContentsElem.querySelectorAll('ul').forEach(function (rootUl) { | ||||
|         rootUl.querySelectorAll('li').forEach(function (liElem) { | ||||
|           liElem.querySelectorAll('ul').forEach(function (ulElem) { | ||||
|             ulElem.style.display = 'none'; | ||||
|           }); | ||||
|         }); | ||||
|       }) : null; | ||||
| 
 | ||||
|       if (false === tocFolding) { | ||||
| 
 | ||||
|       } else { | ||||
|         tableOfContentsElem.querySelectorAll('ul') ? | ||||
|           tableOfContentsElem.querySelectorAll('ul').forEach(function (rootUl) { | ||||
|             rootUl.querySelectorAll('li').forEach(function (liElem) { | ||||
|               liElem.querySelectorAll('ul').forEach(function (ulElem) { | ||||
|                 ulElem.style.display = 'none'; | ||||
|               }); | ||||
|             }); | ||||
|           }) : null; | ||||
|       } | ||||
| 
 | ||||
|       if (tableOfContentsElem) { | ||||
|         if (tableOfContentsElem.querySelectorAll('a').length > 0) { | ||||
|  |  | |||
|  | @ -4,9 +4,9 @@ | |||
|     {{ partial "sidebar/site-bio" . }} | ||||
|     {{ partial "sidebar/custom-home" . }} | ||||
| 
 | ||||
|     {{ if and .Site.Params.itemsPerCategory .Site.Params.enableHomeSidebarTitles }} | ||||
|     {{ if and ($.Param "itemsPerCategory") ($.Param "enableHomeSidebarTitles") }} | ||||
|         {{ $filteredSections := .Site.Sections }} | ||||
|         {{ range .Site.Params.notAllowedTypesInHomeSidebar }} | ||||
|         {{ range $.Param "notAllowedTypesInHomeSidebar" }} | ||||
|             {{ $filteredSections = (where $filteredSections "Type" "!=" (lower .)) }} | ||||
|         {{ end }} | ||||
| 
 | ||||
|  | @ -14,7 +14,7 @@ | |||
|         <section class="sidebar-recent"> | ||||
|             <a href="{{ .RelPermalink }}" class="sidebar-recent__title p2">{{ .Title }}</a> | ||||
|             <ul class="sidebar-recent__ul"> | ||||
|                 {{ range first .Site.Params.itemsPerCategory .Pages }} | ||||
|                 {{ range first ($.Param "itemsPerCategory") .Pages }} | ||||
|                     <li> | ||||
|                         <a href="{{ .RelPermalink }}" class="sidebar-recent__a p2">{{ .Title }}</a> | ||||
|                     </li> | ||||
|  |  | |||
|  | @ -3,8 +3,8 @@ | |||
| <ul class="sidebar"> | ||||
|     {{ partial "search/site-search" . }} | ||||
|     {{ partial "sidebar/custom-list" . }} | ||||
|     {{ if and .Site.Params.itemsPerCategory .Site.Params.enableListSidebarTitles }} | ||||
|         {{ range first .Site.Params.itemsPerCategory .Pages }} | ||||
|     {{ if and ($.Param "itemsPerCategory") ($.Param "enableListSidebarTitles") }} | ||||
|         {{ range first ($.Param "itemsPerCategory") .Pages }} | ||||
|         <li class="sidebar-recent"> | ||||
|             <a href="{{ .RelPermalink }}" class="sidebar-recent__title p1">{{ .Title }}</a> | ||||
|         </li> | ||||
|  |  | |||
|  | @ -11,7 +11,7 @@ | |||
|       </label> | ||||
|     {{ end }} | ||||
|   </div> | ||||
|   <div class="toc {{ if $.Param "hideToc" }}hide{{ end }}" data-dir="{{ if eq ($.Param "languagedir") "rtl" }}rtl{{ else }}ltr{{ end }}"> | ||||
|   <div class="toc {{ if $.Param "hideToc" }}hide{{ end }}" data-dir="{{ if eq ($.Param "languagedir") "rtl" }}rtl{{ else }}ltr{{ end }}" data-folding="{{ if $.Param "tocFolding" }}true{{ else }}false{{ end }}"> | ||||
|     {{ .TableOfContents }} | ||||
|   </div> | ||||
| </section> | ||||
|  |  | |||
|  | @ -1,8 +1,8 @@ | |||
| <article class="summary-classic"> | ||||
|   <div class="summary-classic__flex-box" {{ if eq .Site.Params.sidebarPosition "left" }}data-position="left"{{ end }}> | ||||
|   <div class="summary-classic__flex-box" {{ if eq ($.Param "sidebarPosition") "left" }}data-position="left"{{ end }}> | ||||
|     {{ $params := .Params }} | ||||
|      | ||||
|     {{ if and $params.featured_image (eq .Site.Params.sidebarPosition "right") }} | ||||
|     {{ if and $params.featured_image (eq ($.Param "sidebarPosition") "right") }} | ||||
|     <div class="summary-classic__image-wrapper"> | ||||
|       <a href="{{ .Permalink }}"> | ||||
|         <img data-src="{{ (print "images/" $params.featured_image) | relURL }}" alt="{{ print $params.featured_image }}" src="data:image/svg+xml,%0A%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='none' d='M0 0h24v24H0V0z'/%3E%3Cpath fill='%23aaa' d='M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-1 16H6c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h12c.55 0 1 .45 1 1v12c0 .55-.45 1-1 1zm-4.44-6.19l-2.35 3.02-1.56-1.88c-.2-.25-.58-.24-.78.01l-1.74 2.23c-.26.33-.02.81.39.81h8.98c.41 0 .65-.47.4-.8l-2.55-3.39c-.19-.26-.59-.26-.79 0z'/%3E%3C/svg%3E" class="lazyload summary-classic__image" /> | ||||
|  | @ -26,7 +26,7 @@ | |||
|       </div> | ||||
|     </div> | ||||
| 
 | ||||
|     {{ if and $params.featured_image (eq .Site.Params.sidebarPosition "left") }} | ||||
|     {{ if and $params.featured_image (eq ($.Param "sidebarPosition") "left") }} | ||||
|     <div class="summary-classic__image-wrapper"> | ||||
|       <a href="{{ .Permalink }}"> | ||||
|         <img data-src="{{ (print "images/" $params.featured_image) | relURL }}" alt="{{ print $params.featured_image }}" src="data:image/svg+xml,%0A%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='none' d='M0 0h24v24H0V0z'/%3E%3Cpath fill='%23aaa' d='M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-1 16H6c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h12c.55 0 1 .45 1 1v12c0 .55-.45 1-1 1zm-4.44-6.19l-2.35 3.02-1.56-1.88c-.2-.25-.58-.24-.78.01l-1.74 2.23c-.26.33-.02.81.39.81h8.98c.41 0 .65-.47.4-.8l-2.55-3.39c-.19-.26-.59-.26-.79 0z'/%3E%3C/svg%3E" class="lazyload summary-classic__image" /> | ||||
|  |  | |||
|  | @ -1,14 +1,14 @@ | |||
| {{ define "main" }} | ||||
| <main class="main showcase inner" data-sidebar-position="{{ $.Param "sidebarPosition" }}"> | ||||
|   {{ if .Params.enableBio }} | ||||
|     <aside class="{{ if eq .Site.Params.sidebarPosition "left" }}l{{ else }}r{{ end }}"> | ||||
|     <aside class="{{ if eq ($.Param "sidebarPosition") "left" }}l{{ else }}r{{ end }}"> | ||||
|       <div class="showcase__bio"> | ||||
|         {{ partial "search/site-search" . }} | ||||
|         {{ partial "sidebar/site-bio" . }} | ||||
|       </div> | ||||
|     </aside> | ||||
|   {{ end }} | ||||
|   <section class="showcase__section {{ if .Params.enableBio }}{{ if eq .Site.Params.sidebarPosition "left" }}mr{{ else }}lm{{ end }}{{ else }}lmr{{ end }}"> | ||||
|   <section class="showcase__section {{ if .Params.enableBio }}{{ if eq ($.Param "sidebarPosition") "left" }}mr{{ else }}lm{{ end }}{{ else }}lmr{{ end }}"> | ||||
|     {{ if .Params.enableBio }} | ||||
|       <div class="showcase__bio--mobile hide"> | ||||
|         {{ partial "body/whoami" . }} | ||||
|  |  | |||
|  | @ -13,7 +13,7 @@ | |||
| <main class="main archive"> | ||||
|   <div class="archive__container"> | ||||
|     {{ $pages := (where .Site.RegularPages "Section" "talks") }} | ||||
|     {{ $paginator := .Paginate ($pages.GroupByPublishDate (.Site.Params.talksGroupByDate | default "2006")) .Site.Params.talksPaginate }} | ||||
|     {{ $paginator := .Paginate ($pages.GroupByPublishDate ($.Param "talksGroupByDate" | default "2006")) ($.Param "talksPaginate") }} | ||||
| 
 | ||||
|     {{ range ($paginator).PageGroups }} | ||||
|     <span class="archive__key">{{ .Key }}</span> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 zzossig
						zzossig