diff --git a/README.ko.md b/README.ko.md index b5d2e4b..22cec9f 100644 --- a/README.ko.md +++ b/README.ko.md @@ -270,6 +270,7 @@ enableHomeSidebarTitles = true 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 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 diff --git a/README.md b/README.md index e19ea76..d2a16db 100644 --- a/README.md +++ b/README.md @@ -263,6 +263,7 @@ enableHomeSidebarTitles = true 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 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 diff --git a/archetypes/default.md b/archetypes/default.md index 36d267e..c260c35 100644 --- a/archetypes/default.md +++ b/archetypes/default.md @@ -6,6 +6,7 @@ draft: false hideToc: false enableToc: true enableTocContent: false +tocPosition: inner tags: - series: diff --git a/assets/sass/components/_summary.scss b/assets/sass/components/_summary.scss index d111110..6a2cc14 100644 --- a/assets/sass/components/_summary.scss +++ b/assets/sass/components/_summary.scss @@ -138,6 +138,8 @@ min-width: 130px; overflow: hidden; border-radius: 0.25rem; + padding: 0.25rem; + margin-right: .5rem; @include transition(all, 0.25s, ease-in); @include align-self(center); diff --git a/assets/sass/components/_toc.scss b/assets/sass/components/_toc.scss index 1401925..6738937 100644 --- a/assets/sass/components/_toc.scss +++ b/assets/sass/components/_toc.scss @@ -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 { diff --git a/assets/sass/layout/_body.scss b/assets/sass/layout/_body.scss index 71c826c..9aae057 100644 --- a/assets/sass/layout/_body.scss +++ b/assets/sass/layout/_body.scss @@ -1,12 +1,15 @@ #container { position: relative; + + @include flexbox(); + @include themify($themes) { color: themed('body-color'); background-color: themed('backdrop-background-color'); hr { border-color: themed('hr-color'); } - } + } } html { diff --git a/assets/sass/layout/_grid.scss b/assets/sass/layout/_grid.scss index 57245f2..7b17b43 100644 --- a/assets/sass/layout/_grid.scss +++ b/assets/sass/layout/_grid.scss @@ -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-column-gap: $grid_column_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 { diff --git a/assets/sass/main.scss b/assets/sass/main.scss index 3a3a4cd..e8e5d40 100644 --- a/assets/sass/main.scss +++ b/assets/sass/main.scss @@ -80,4 +80,5 @@ $cursive-font: {{ .Site.Data.font.cursive_font }}; @import 'pages/terms'; @import 'pages/contact'; @import 'pages/talk'; -@import 'pages/showcase'; \ No newline at end of file +@import 'pages/showcase'; +@import 'pages/wrapper'; \ No newline at end of file diff --git a/assets/sass/pages/_showcase.scss b/assets/sass/pages/_showcase.scss index 0818302..e82e8fd 100644 --- a/assets/sass/pages/_showcase.scss +++ b/assets/sass/pages/_showcase.scss @@ -6,7 +6,7 @@ position: sticky; top: $grid_navbar_height * 1.25; display: block; - margin-top: 1rem; + margin-top: 0.5rem; @media only screen and (max-width: 600px) { display: none; @@ -64,14 +64,9 @@ } } - &__title { - margin: 2rem 0.5rem 0.25rem 0; - font-size: 1.125rem; - } - &__box { width: 100%; - max-width: 48.2%; + max-width: 48%; height: auto; border-radius: 0.2rem; padding: 1rem; @@ -101,7 +96,7 @@ } @media only screen and (max-width: 1180px) { - max-width: 48.2%; + max-width: 48%; } @media only screen and (max-width: 769px) { diff --git a/assets/sass/pages/_wrapper.scss b/assets/sass/pages/_wrapper.scss new file mode 100644 index 0000000..28bdc67 --- /dev/null +++ b/assets/sass/pages/_wrapper.scss @@ -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); + } +} \ No newline at end of file diff --git a/data/grid.toml b/data/grid.toml index d8a2f17..beb766b 100644 --- a/data/grid.toml +++ b/data/grid.toml @@ -7,4 +7,4 @@ grid_main_side_unit = "fr" # "fr", "px" grid_column_gap_width = "32" grid_column_gap_unit = "px" # "px" grid_navbar_height = "50px" # "px" -grid_row_gap = "0" \ No newline at end of file +grid_row_gap = "0" diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index f59cfd8..b525c7a 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -46,6 +46,7 @@ enableHomeSidebarTitles = true enableListSidebarTitles = true enableToc = true hideToc = false +tocPosition = "inner" # inner, outer enableTocSwitch = true itemsPerCategory = 5 sidebarPosition = "right" diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 042148c..377ca6c 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -22,14 +22,15 @@
- {{ partial "body/custom-wrapper" . }} + {{ partial "body/main-left" . }}
{{ partial "navbar/site-nav" . }} {{ partial "header/site-header" . }} {{ block "main" . }}{{ end }} {{ partial "body/custom-body" . }} {{ partial "footer/site-footer" . }} -
+
+ {{ partial "body/main-right" . }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index cf33b50..c061135 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -3,7 +3,7 @@ {{ $enquire := resources.Get "js/enquire.min.js" | resources.Fingerprint }} -
+
{{ if eq .Site.Params.enableBreadcrumb true }} {{ partial "body/breadcrumb" . }} {{ end }} @@ -30,7 +30,7 @@
-{{ if or ($.Param "enableToc") ($.Param "toc") }} +{{ if and (or ($.Param "enableToc") ($.Param "toc")) (ne ($.Param "tocPosition") "outer") }} @@ -38,27 +38,48 @@ {{ if in ($.Scratch.Get "show") $cur }}
  • {{ .PageNumber }}
  • diff --git a/layouts/partials/script/single-script.html b/layouts/partials/script/single-script.html index 7360ced..09d7164 100644 --- a/layouts/partials/script/single-script.html +++ b/layouts/partials/script/single-script.html @@ -116,7 +116,7 @@ var toc = JSON.parse({{ $toc | jsonify }}); var hideToc = JSON.parse({{ $hideToc | jsonify }}); - if (enableToc || toc) { + if ((enableToc || toc) && document.querySelector('.toc')) { var tableOfContentsElem = document.querySelector('.toc').querySelector('#TableOfContents'); tableOfContentsElem.querySelectorAll('ul > li').forEach(function (liElem) { liElem.querySelectorAll('ul').forEach(function (ulElem) { diff --git a/layouts/partials/showcase/show-nav.html b/layouts/partials/showcase/show-nav.html index 3de5f37..89f7ce1 100644 --- a/layouts/partials/showcase/show-nav.html +++ b/layouts/partials/showcase/show-nav.html @@ -6,8 +6,8 @@ {{ range (.Site.GetPage "section" .Type).Pages }} {{ $active := false }} {{ $active = or $active (eq .Name $current.Title) }} - {{ $active = or $active (eq (lower .URL) (lower $current.Title)) }} - {{ $active = or $active (eq (lower .URL) (lower $current.Type)) }} + {{ $active = or $active (eq (lower .Permalink) (lower $current.Title)) }} + {{ $active = or $active (eq (lower .Permalink) (lower $current.Type)) }} {{ i18n (lower .Title) | default .Title }} diff --git a/layouts/partials/showcase/show-pinned.html b/layouts/partials/showcase/show-pinned.html index 036f498..2251a7b 100644 --- a/layouts/partials/showcase/show-pinned.html +++ b/layouts/partials/showcase/show-pinned.html @@ -6,9 +6,6 @@ {{ end }} {{ if gt $pinnedNum 0 }} -
    - {{ i18n "showcase-pinned" }} -
      {{ range .Pages }} diff --git a/layouts/partials/showcase/show-section.html b/layouts/partials/showcase/show-section.html index f2b5d53..dabdb08 100644 --- a/layouts/partials/showcase/show-section.html +++ b/layouts/partials/showcase/show-section.html @@ -10,14 +10,17 @@ {{ .Title }} - {{ if (isset .Params "thumb") | or (eq .Params.thumb "") }} + + {{ if .Params.thumb }} {{ .Title }} {{ end }} +
      {{ .Description }}
      +
      {{ partial "svgs/etc/code.svg" (dict "width" 14 "height" 14) }} diff --git a/layouts/partials/sidebar/sidebar-single.html b/layouts/partials/sidebar/sidebar-single.html index c365f60..5162b01 100644 --- a/layouts/partials/sidebar/sidebar-single.html +++ b/layouts/partials/sidebar/sidebar-single.html @@ -1,5 +1,5 @@ {{ if $.Param "enableSidebar" }} -{{ if or ($.Param "enableToc") ($.Param "toc") }} +{{ if and (or ($.Param "enableToc") ($.Param "toc")) (ne ($.Param "tocPosition") "outer") }}