outer toc option added, fixed deprecation page.URL warning
This commit is contained in:
parent
1c3bf2ff58
commit
4fdc1dfbc0
|
@ -270,6 +270,7 @@ enableHomeSidebarTitles = true
|
||||||
enableListSidebarTitles = true
|
enableListSidebarTitles = true
|
||||||
enableToc = true # single page table of contents, you can replace this param to toc(toc = true)
|
enableToc = true # single page table of contents, you can replace this param to toc(toc = true)
|
||||||
hideToc = false # Hide or Show toc
|
hideToc = false # Hide or Show toc
|
||||||
|
tocPosition = "inner" # inner, outer
|
||||||
enableTocSwitch = true # single page table of contents visibility switch
|
enableTocSwitch = true # single page table of contents visibility switch
|
||||||
itemsPerCategory = 5 # maximum number of posts shown in the sidebar.
|
itemsPerCategory = 5 # maximum number of posts shown in the sidebar.
|
||||||
sidebarPosition = "right" # bio, profile component layout position
|
sidebarPosition = "right" # bio, profile component layout position
|
||||||
|
|
|
@ -263,6 +263,7 @@ enableHomeSidebarTitles = true
|
||||||
enableListSidebarTitles = true
|
enableListSidebarTitles = true
|
||||||
enableToc = true # single page table of contents, you can replace this param to toc(toc = true)
|
enableToc = true # single page table of contents, you can replace this param to toc(toc = true)
|
||||||
hideToc = false # Hide or Show toc
|
hideToc = false # Hide or Show toc
|
||||||
|
tocPosition = "inner" # inner, outer
|
||||||
enableTocSwitch = true # single page table of contents visibility switch
|
enableTocSwitch = true # single page table of contents visibility switch
|
||||||
itemsPerCategory = 5 # maximum number of posts shown in the sidebar.
|
itemsPerCategory = 5 # maximum number of posts shown in the sidebar.
|
||||||
sidebarPosition = "right" # bio, profile component layout position
|
sidebarPosition = "right" # bio, profile component layout position
|
||||||
|
|
|
@ -6,6 +6,7 @@ draft: false
|
||||||
hideToc: false
|
hideToc: false
|
||||||
enableToc: true
|
enableToc: true
|
||||||
enableTocContent: false
|
enableTocContent: false
|
||||||
|
tocPosition: inner
|
||||||
tags:
|
tags:
|
||||||
-
|
-
|
||||||
series:
|
series:
|
||||||
|
|
|
@ -138,6 +138,8 @@
|
||||||
min-width: 130px;
|
min-width: 130px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-radius: 0.25rem;
|
border-radius: 0.25rem;
|
||||||
|
padding: 0.25rem;
|
||||||
|
margin-right: .5rem;
|
||||||
|
|
||||||
@include transition(all, 0.25s, ease-in);
|
@include transition(all, 0.25s, ease-in);
|
||||||
@include align-self(center);
|
@include align-self(center);
|
||||||
|
|
|
@ -80,6 +80,16 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__outer {
|
||||||
|
padding-right: 1rem;
|
||||||
|
padding-left: 2.5rem;
|
||||||
|
max-width: calc((100vw - 980px) / 2);
|
||||||
|
|
||||||
|
@media only screen and (max-width: 1300px) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.expand__content {
|
.expand__content {
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
#container {
|
#container {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
@include flexbox();
|
||||||
|
|
||||||
@include themify($themes) {
|
@include themify($themes) {
|
||||||
color: themed('body-color');
|
color: themed('body-color');
|
||||||
background-color: themed('backdrop-background-color');
|
background-color: themed('backdrop-background-color');
|
||||||
hr {
|
hr {
|
||||||
border-color: themed('hr-color');
|
border-color: themed('hr-color');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
|
|
|
@ -12,17 +12,6 @@ $grid_column_gap: $grid_column_gap_width + $grid_column_gap_unit;
|
||||||
grid-template-rows: $grid_navbar_height auto 1fr auto;
|
grid-template-rows: $grid_navbar_height auto 1fr auto;
|
||||||
grid-column-gap: $grid_column_gap;
|
grid-column-gap: $grid_column_gap;
|
||||||
grid-row-gap: $grid_row_gap;
|
grid-row-gap: $grid_row_gap;
|
||||||
|
|
||||||
margin: 0 auto;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
@include justify-content(center);
|
|
||||||
@include themify($themes) {
|
|
||||||
background-color: themed('body-background-color');
|
|
||||||
}
|
|
||||||
@media only screen and (max-width: 769px) {
|
|
||||||
grid-template-columns: minmax(0, $grid_main_main) minmax(0, $grid_main_side);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-main {
|
.header-main {
|
||||||
|
|
|
@ -80,4 +80,5 @@ $cursive-font: {{ .Site.Data.font.cursive_font }};
|
||||||
@import 'pages/terms';
|
@import 'pages/terms';
|
||||||
@import 'pages/contact';
|
@import 'pages/contact';
|
||||||
@import 'pages/talk';
|
@import 'pages/talk';
|
||||||
@import 'pages/showcase';
|
@import 'pages/showcase';
|
||||||
|
@import 'pages/wrapper';
|
|
@ -6,7 +6,7 @@
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: $grid_navbar_height * 1.25;
|
top: $grid_navbar_height * 1.25;
|
||||||
display: block;
|
display: block;
|
||||||
margin-top: 1rem;
|
margin-top: 0.5rem;
|
||||||
|
|
||||||
@media only screen and (max-width: 600px) {
|
@media only screen and (max-width: 600px) {
|
||||||
display: none;
|
display: none;
|
||||||
|
@ -64,14 +64,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__title {
|
|
||||||
margin: 2rem 0.5rem 0.25rem 0;
|
|
||||||
font-size: 1.125rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__box {
|
&__box {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 48.2%;
|
max-width: 48%;
|
||||||
height: auto;
|
height: auto;
|
||||||
border-radius: 0.2rem;
|
border-radius: 0.2rem;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
|
@ -101,7 +96,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 1180px) {
|
@media only screen and (max-width: 1180px) {
|
||||||
max-width: 48.2%;
|
max-width: 48%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 769px) {
|
@media only screen and (max-width: 769px) {
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
$grid_max: $grid_max_width + $grid_max_unit;
|
||||||
|
|
||||||
|
.wrapper {
|
||||||
|
margin: 0 auto;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
@include justify-content(center);
|
||||||
|
@include themify($themes) {
|
||||||
|
background-color: themed('body-background-color');
|
||||||
|
}
|
||||||
|
@media only screen and (max-width: 769px) {
|
||||||
|
grid-template-columns: minmax(0, $grid_main_main) minmax(0, $grid_main_side);
|
||||||
|
}
|
||||||
|
|
||||||
|
&__left {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
height: 100vh;
|
||||||
|
width: calc((100vw - 980px) / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
&__right {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
height: 100vh;
|
||||||
|
width: calc((100vw - 980px) / 2);
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,4 +7,4 @@ grid_main_side_unit = "fr" # "fr", "px"
|
||||||
grid_column_gap_width = "32"
|
grid_column_gap_width = "32"
|
||||||
grid_column_gap_unit = "px" # "px"
|
grid_column_gap_unit = "px" # "px"
|
||||||
grid_navbar_height = "50px" # "px"
|
grid_navbar_height = "50px" # "px"
|
||||||
grid_row_gap = "0"
|
grid_row_gap = "0"
|
||||||
|
|
|
@ -46,6 +46,7 @@ enableHomeSidebarTitles = true
|
||||||
enableListSidebarTitles = true
|
enableListSidebarTitles = true
|
||||||
enableToc = true
|
enableToc = true
|
||||||
hideToc = false
|
hideToc = false
|
||||||
|
tocPosition = "inner" # inner, outer
|
||||||
enableTocSwitch = true
|
enableTocSwitch = true
|
||||||
itemsPerCategory = 5
|
itemsPerCategory = 5
|
||||||
sidebarPosition = "right"
|
sidebarPosition = "right"
|
||||||
|
|
|
@ -22,14 +22,15 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="container">
|
<div id="container">
|
||||||
{{ partial "body/custom-wrapper" . }}
|
{{ partial "body/main-left" . }}
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
{{ partial "navbar/site-nav" . }}
|
{{ partial "navbar/site-nav" . }}
|
||||||
{{ partial "header/site-header" . }}
|
{{ partial "header/site-header" . }}
|
||||||
{{ block "main" . }}{{ end }}
|
{{ block "main" . }}{{ end }}
|
||||||
{{ partial "body/custom-body" . }}
|
{{ partial "body/custom-body" . }}
|
||||||
{{ partial "footer/site-footer" . }}
|
{{ partial "footer/site-footer" . }}
|
||||||
</div>
|
</div>
|
||||||
|
{{ partial "body/main-right" . }}
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
{{ $enquire := resources.Get "js/enquire.min.js" | resources.Fingerprint }}
|
{{ $enquire := resources.Get "js/enquire.min.js" | resources.Fingerprint }}
|
||||||
<script src="{{ $enquire.RelPermalink }}"></script>
|
<script src="{{ $enquire.RelPermalink }}"></script>
|
||||||
|
|
||||||
<main class="single__main {{ if or ($.Param "enableToc") ($.Param "toc") }}{{ if $.Param "hideToc" }}main{{ else }}main-main{{ end }}{{ else }}main{{ end }}">
|
<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 }}
|
{{ if eq .Site.Params.enableBreadcrumb true }}
|
||||||
{{ partial "body/breadcrumb" . }}
|
{{ partial "body/breadcrumb" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
{{ if or ($.Param "enableToc") ($.Param "toc") }}
|
{{ if and (or ($.Param "enableToc") ($.Param "toc")) (ne ($.Param "tocPosition") "outer") }}
|
||||||
<aside class="single__side {{ if or ($.Param "enableToc") ($.Param "toc") }}main-side{{ end }}">
|
<aside class="single__side {{ if or ($.Param "enableToc") ($.Param "toc") }}main-side{{ end }}">
|
||||||
{{ partial "sidebar/sidebar-single" . }}
|
{{ partial "sidebar/sidebar-single" . }}
|
||||||
</aside>
|
</aside>
|
||||||
|
@ -38,27 +38,48 @@
|
||||||
<script>
|
<script>
|
||||||
{{ $enableToc:= $.Param "enableToc" }}
|
{{ $enableToc:= $.Param "enableToc" }}
|
||||||
{{ $toc:= $.Param "toc" }}
|
{{ $toc:= $.Param "toc" }}
|
||||||
|
{{ $tocPosition:= $.Param "tocPosition" }}
|
||||||
|
|
||||||
var enableToc = JSON.parse({{ $enableToc | jsonify }});
|
var enableToc = JSON.parse({{ $enableToc | jsonify }});
|
||||||
var toc = JSON.parse({{ $toc | jsonify }});
|
var toc = JSON.parse({{ $toc | jsonify }});
|
||||||
|
var tocPosition = JSON.parse({{ $tocPosition | jsonify }});
|
||||||
|
|
||||||
var singleMainElem = document.querySelector('.single__main');
|
var singleMainElem = document.querySelector('.single__main');
|
||||||
var singleSideElem = document.querySelector('.single__side');
|
var singleSideElem = document.querySelector('.single__side');
|
||||||
|
|
||||||
enquire.register("screen and (max-width: 769px)", {
|
enquire.register("screen and (max-width: 769px)", {
|
||||||
match: function () {
|
match: function () {
|
||||||
if (enableToc || toc) {
|
if ((enableToc || toc) && tocPosition !== "outer") {
|
||||||
singleMainElem.classList.remove('main-main');
|
if (singleMainElem && singleSideElem) {
|
||||||
singleMainElem.classList.add('main');
|
singleMainElem.classList.remove('main-main');
|
||||||
singleSideElem.classList.remove('main-side');
|
singleMainElem.classList.add('main');
|
||||||
singleSideElem.classList.add('hide');
|
singleSideElem.classList.remove('main-side');
|
||||||
|
singleSideElem.classList.add('hide');
|
||||||
|
}
|
||||||
|
} else if (tocPosition === "outer") {
|
||||||
|
if (singleMainElem && !singleMainElem.classList.contains('main-main')) {
|
||||||
|
singleMainElem.classList.remove('main-main');
|
||||||
|
singleMainElem.classList.add('main');
|
||||||
|
}
|
||||||
|
if (singleSideElem && !singleSideElem.classList.contains('hide')) {
|
||||||
|
singleSideElem.classList.add('hide');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
unmatch: function () {
|
unmatch: function () {
|
||||||
if (enableToc || toc) {
|
if ((enableToc || toc) && tocPosition !== "outer") {
|
||||||
singleMainElem.classList.remove('main');
|
singleMainElem.classList.remove('main');
|
||||||
singleMainElem.classList.add('main-main');
|
singleMainElem.classList.add('main-main');
|
||||||
singleSideElem.classList.remove('hide');
|
singleSideElem.classList.remove('hide');
|
||||||
singleSideElem.classList.add('main-side');
|
singleSideElem.classList.add('main-side');
|
||||||
|
} else if (tocPosition === "outer") {
|
||||||
|
if (singleMainElem && !singleMainElem.classList.contains('main-main')) {
|
||||||
|
singleMainElem.classList.remove('main-main');
|
||||||
|
singleMainElem.classList.add('main');
|
||||||
|
}
|
||||||
|
if (singleSideElem && !singleSideElem.classList.contains('hide')) {
|
||||||
|
singleSideElem.classList.add('hide');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementsByClassName('navbar__burger')[0].classList.remove('is-active');
|
document.getElementsByClassName('navbar__burger')[0].classList.remove('is-active');
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
<!-- override this file -->
|
|
|
@ -0,0 +1 @@
|
||||||
|
<div class="wrapper__left"></div>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<div class="wrapper__right">
|
||||||
|
{{ if eq ($.Param "tocPosition") "outer" }}
|
||||||
|
{{ if or ($.Param "enableToc") ($.Param "toc") }}
|
||||||
|
<div class="toc toc__outer {{ if $.Param "hideToc" }}hide{{ end }}">
|
||||||
|
{{ .TableOfContents }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
|
@ -20,6 +20,8 @@
|
||||||
<ul class="pagination">
|
<ul class="pagination">
|
||||||
{{ range $pag.Pagers }}
|
{{ range $pag.Pagers }}
|
||||||
{{ $cur := .PageNumber }}
|
{{ $cur := .PageNumber }}
|
||||||
|
<script>
|
||||||
|
</script>
|
||||||
{{ if in ($.Scratch.Get "show") $cur }}
|
{{ if in ($.Scratch.Get "show") $cur }}
|
||||||
<li
|
<li
|
||||||
{{ if eq . $pag }}class="active"{{ end }}><a href="{{ .URL }}">{{ .PageNumber }}</a></li>
|
{{ if eq . $pag }}class="active"{{ end }}><a href="{{ .URL }}">{{ .PageNumber }}</a></li>
|
||||||
|
|
|
@ -116,7 +116,7 @@
|
||||||
var toc = JSON.parse({{ $toc | jsonify }});
|
var toc = JSON.parse({{ $toc | jsonify }});
|
||||||
var hideToc = JSON.parse({{ $hideToc | jsonify }});
|
var hideToc = JSON.parse({{ $hideToc | jsonify }});
|
||||||
|
|
||||||
if (enableToc || toc) {
|
if ((enableToc || toc) && document.querySelector('.toc')) {
|
||||||
var tableOfContentsElem = document.querySelector('.toc').querySelector('#TableOfContents');
|
var tableOfContentsElem = document.querySelector('.toc').querySelector('#TableOfContents');
|
||||||
tableOfContentsElem.querySelectorAll('ul > li').forEach(function (liElem) {
|
tableOfContentsElem.querySelectorAll('ul > li').forEach(function (liElem) {
|
||||||
liElem.querySelectorAll('ul').forEach(function (ulElem) {
|
liElem.querySelectorAll('ul').forEach(function (ulElem) {
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
{{ range (.Site.GetPage "section" .Type).Pages }}
|
{{ range (.Site.GetPage "section" .Type).Pages }}
|
||||||
{{ $active := false }}
|
{{ $active := false }}
|
||||||
{{ $active = or $active (eq .Name $current.Title) }}
|
{{ $active = or $active (eq .Name $current.Title) }}
|
||||||
{{ $active = or $active (eq (lower .URL) (lower $current.Title)) }}
|
{{ $active = or $active (eq (lower .Permalink) (lower $current.Title)) }}
|
||||||
{{ $active = or $active (eq (lower .URL) (lower $current.Type)) }}
|
{{ $active = or $active (eq (lower .Permalink) (lower $current.Type)) }}
|
||||||
<a href="{{ .Permalink }}" class="showcase__button {{ if $active }}active{{ end }}" data-meta="{{ len .Pages }}">
|
<a href="{{ .Permalink }}" class="showcase__button {{ if $active }}active{{ end }}" data-meta="{{ len .Pages }}">
|
||||||
{{ i18n (lower .Title) | default .Title }}
|
{{ i18n (lower .Title) | default .Title }}
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -6,9 +6,6 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if gt $pinnedNum 0 }}
|
{{ if gt $pinnedNum 0 }}
|
||||||
<div class="showcase__title">
|
|
||||||
{{ i18n "showcase-pinned" }}
|
|
||||||
</div>
|
|
||||||
<div style="display: flex; justify-content: center">
|
<div style="display: flex; justify-content: center">
|
||||||
<ol class="showcase__box--wrapper">
|
<ol class="showcase__box--wrapper">
|
||||||
{{ range .Pages }}
|
{{ range .Pages }}
|
||||||
|
|
|
@ -10,14 +10,17 @@
|
||||||
<a href="{{ .Params.Link }}" class="showcase__box--title" target="_blank" rel="noreferrer">
|
<a href="{{ .Params.Link }}" class="showcase__box--title" target="_blank" rel="noreferrer">
|
||||||
{{ .Title }}
|
{{ .Title }}
|
||||||
</a>
|
</a>
|
||||||
{{ if (isset .Params "thumb") | or (eq .Params.thumb "") }}
|
|
||||||
|
{{ if .Params.thumb }}
|
||||||
<a href="{{ .Params.Link }}" class="showcase__box--img" target="_blank" rel="noreferrer">
|
<a href="{{ .Params.Link }}" class="showcase__box--img" target="_blank" rel="noreferrer">
|
||||||
<img src="{{ (print "images/" .Params.thumb) | relURL }}" alt="{{ .Title }}">
|
<img src="{{ (print "images/" .Params.thumb) | relURL }}" alt="{{ .Title }}">
|
||||||
</a>
|
</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<div class="showcase__box--desc">
|
<div class="showcase__box--desc">
|
||||||
{{ .Description }}
|
{{ .Description }}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="grow"></div>
|
||||||
<div class="showcase__box--meta">
|
<div class="showcase__box--meta">
|
||||||
<span class="type">
|
<span class="type">
|
||||||
{{ partial "svgs/etc/code.svg" (dict "width" 14 "height" 14) }}
|
{{ partial "svgs/etc/code.svg" (dict "width" 14 "height" 14) }}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{{ if $.Param "enableSidebar" }}
|
{{ if $.Param "enableSidebar" }}
|
||||||
{{ if or ($.Param "enableToc") ($.Param "toc") }}
|
{{ if and (or ($.Param "enableToc") ($.Param "toc")) (ne ($.Param "tocPosition") "outer") }}
|
||||||
|
|
||||||
<section class="sidebar">
|
<section class="sidebar">
|
||||||
<div class="toc__flexbox" data-position="{{ if $.Param "hideToc" }}absolute{{ else }}fixed{{ end }}">
|
<div class="toc__flexbox" data-position="{{ if $.Param "hideToc" }}absolute{{ else }}fixed{{ end }}">
|
||||||
|
|
Loading…
Reference in New Issue