more sidebar options

notAllowedTypesInHomeSidebar
enableHomeSidebarTitles
This commit is contained in:
zzossig 2020-01-19 14:11:58 +09:00
parent 510f4407ab
commit 6d9ab52197
8 changed files with 52 additions and 31 deletions

View File

@ -228,6 +228,7 @@ useFaviconGenerator = false # https://www.favicon-generator.org/
themeOptions = ["dark", "light", "hacker", "solarized", "kimbie"] # select options for site color theme themeOptions = ["dark", "light", "hacker", "solarized", "kimbie"] # select options for site color theme
notAllowedTypesInHome = ["contact", "talks", "about"] # not allowed page types in home page. type can be set in front matter or default to folder name. notAllowedTypesInHome = ["contact", "talks", "about"] # not allowed page types in home page. type can be set in front matter or default to folder name.
notAllowedTypesInHomeSidebar = ["about", "archive"] # not allowed page types in home page sidebar(recent post titles).
# header # header
homeHeaderType = "text" # text, img, slide homeHeaderType = "text" # text, img, slide
@ -263,6 +264,7 @@ enableSidebar = true # Set to false to create the full width of the content.
enableSidebarTags = true # if you want to use tags. enableSidebarTags = true # if you want to use tags.
enableSidebarSeries = true enableSidebarSeries = true
enableSidebarCategories = true enableSidebarCategories = true
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

View File

@ -222,6 +222,7 @@ useFaviconGenerator = false # https://www.favicon-generator.org/
themeOptions = ["dark", "light", "hacker", "solarized", "kimbie"] # select options for site color theme themeOptions = ["dark", "light", "hacker", "solarized", "kimbie"] # select options for site color theme
notAllowedTypesInHome = ["contact", "talks", "about"] # not allowed page types in home page. type can be set in front matter or default to folder name. notAllowedTypesInHome = ["contact", "talks", "about"] # not allowed page types in home page. type can be set in front matter or default to folder name.
notAllowedTypesInHomeSidebar = ["about", "archive"] # not allowed page types in home page sidebar(recent post titles).
# header # header
homeHeaderType = "text" # text, img, slide homeHeaderType = "text" # text, img, slide
@ -254,10 +255,10 @@ link = "https://github.com/zzossig/hugo-theme-zzo"
# sidebar # sidebar
enableBio = true # home page sidebar enableBio = true # home page sidebar
enableSidebar = true # Set to false to create the full width of the content. enableSidebar = true # Set to false to create the full width of the content.
enableSidebarTitles = true
enableSidebarTags = true # if you want to use tags. enableSidebarTags = true # if you want to use tags.
enableSidebarSeries = true enableSidebarSeries = true
enableSidebarCategories = true enableSidebarCategories = true
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

View File

@ -6,7 +6,9 @@
font-size: 0.85rem; font-size: 0.85rem;
padding-left: 0.5rem; padding-left: 0.5rem;
z-index: z('toc'); z-index: z('toc');
@include no-select; @include no-select;
@include animation('slide-in-down-little .2s .6s 1 ease-in both');
#TableOfContents { #TableOfContents {
position: relative; position: relative;

View File

@ -3,11 +3,13 @@
margin-right: 1rem; margin-right: 1rem;
&-recent { &-recent {
padding: 0.5rem; padding: 0.25rem;
&__title { &__title {
font-family: $title-font; font-family: $title-font;
font-weight: 700; font-weight: 700;
font-size: 0.95rem;
@include themify($themes) { @include themify($themes) {
color: themed('sidebar-title-color'); color: themed('sidebar-title-color');
&:hover { &:hover {
@ -17,12 +19,12 @@
} }
&__ul { &__ul {
margin-left: 0.5rem; margin-left: 0.25rem;
li { li {
text-indent: -0.35em; text-indent: -0.4em;
padding-left: 0.5em; padding-left: 0.5em;
&::before { &::before {
padding-right: 0.5rem; padding-right: 0.125rem;
font-size: 1rem; font-size: 1rem;
display: inline-block; display: inline-block;
content: "\2022"; content: "\2022";
@ -31,6 +33,7 @@
} }
&__a { &__a {
font-size: 0.95rem;
@include themify($themes) { @include themify($themes) {
color: themed('sidebar-li-color'); color: themed('sidebar-li-color');
} }
@ -41,3 +44,14 @@
margin: 1.5rem 0; margin: 1.5rem 0;
} }
} }
li.sidebar-recent {
text-indent: -0.4em;
padding-left: 0.5em;
&::before {
padding-right: 0.125rem;
font-size: 1rem;
display: inline-block;
content: "\2022";
}
}

View File

@ -7,6 +7,7 @@ useFaviconGenerator = true # https://www.favicon-generator.org/
themeOptions = ["dark", "light", "hacker", "solarized", "kimbie"] themeOptions = ["dark", "light", "hacker", "solarized", "kimbie"]
notAllowedTypesInHome = ["contact", "talks", "about"] notAllowedTypesInHome = ["contact", "talks", "about"]
notAllowedTypesInHomeSidebar = ["about", "archive"]
# header # header
homeHeaderType = "text" # text, img, slide homeHeaderType = "text" # text, img, slide
@ -40,6 +41,7 @@ enableSidebar = true
enableSidebarTags = true enableSidebarTags = true
enableSidebarSeries = true enableSidebarSeries = true
enableSidebarCategories = true enableSidebarCategories = true
enableHomeSidebarTitles = true
enableListSidebarTitles = true enableListSidebarTitles = true
enableToc = true enableToc = true
hideToc = false hideToc = false

View File

@ -4,22 +4,28 @@
{{ partial "sidebar/site-bio" . }} {{ partial "sidebar/site-bio" . }}
{{ partial "sidebar/custom-home" . }} {{ partial "sidebar/custom-home" . }}
{{ range (and (where .Site.Sections "Type" "!=" "about") (where .Site.Sections "Type" "!=" "archive")) }} {{ if and .Site.Params.itemsPerCategory .Site.Params.enableHomeSidebarTitles }}
{{ $filteredSections := .Site.Sections }}
{{ range .Site.Params.notAllowedTypesInHomeSidebar }}
{{ $filteredSections = (where $filteredSections "Type" "!=" (lower .)) }}
{{ end }}
{{ range $filteredSections }}
<section class="sidebar-recent"> <section class="sidebar-recent">
<a href="{{ .RelPermalink }}" class="sidebar-recent__title p2">{{ .Title }}</a> <a href="{{ .RelPermalink }}" class="sidebar-recent__title p2">{{ .Title }}</a>
<ul class="sidebar-recent__ul"> <ul class="sidebar-recent__ul">
{{ if .Site.Params.itemsPerCategory }}
{{ range first .Site.Params.itemsPerCategory .Pages }} {{ range first .Site.Params.itemsPerCategory .Pages }}
<li><a href="{{ .RelPermalink }}" class="sidebar-recent__a p2">{{ .Title }}</a> <li>
<a href="{{ .RelPermalink }}" class="sidebar-recent__a p2">{{ .Title }}</a>
</li> </li>
{{ end }} {{ end }}
{{ end }}
</ul> </ul>
</section> </section>
<hr class="hr-fade sidebar-hr" />
{{ end }}
{{ end }} {{ end }}
</div> </div>
<hr class="hr-fade sidebar-hr" />
<div class="taxo-root"> <div class="taxo-root">
{{ partial "taxonomy/taxonomy-tags" . }} {{ partial "taxonomy/taxonomy-tags" . }}
{{ partial "taxonomy/taxonomy-categories" . }} {{ partial "taxonomy/taxonomy-categories" . }}

View File

@ -1,23 +1,17 @@
{{ if $.Param "enableSidebar" }} {{ if $.Param "enableSidebar" }}
<div class="sidebar"> <ul class="sidebar">
{{ partial "search/site-search" . }} {{ partial "search/site-search" . }}
{{ partial "sidebar/custom-list" . }} {{ partial "sidebar/custom-list" . }}
{{ if and .Site.Params.itemsPerCategory .Site.Params.enableListSidebarTitles }} {{ if and .Site.Params.itemsPerCategory .Site.Params.enableListSidebarTitles }}
{{ range first .Site.Params.itemsPerCategory .Pages }} {{ range first .Site.Params.itemsPerCategory .Pages }}
<section class="sidebar-recent"> <li class="sidebar-recent">
<a href="{{ .RelPermalink }}" class="sidebar-recent__title p1">{{ .Title }}</a> <a href="{{ .RelPermalink }}" class="sidebar-recent__title p1">{{ .Title }}</a>
<ul class="sidebar-recent__ul">
{{ range first .Site.Params.itemsPerCategory .Pages }}
<li><a href="{{ .RelPermalink }}" class="sidebar-recent__a p2">{{ .Title }}</a>
</li> </li>
{{ end }} {{ end }}
</ul>
</section>
{{ end }}
<hr class="hr-fade sidebar-hr" /> <hr class="hr-fade sidebar-hr" />
{{ end }} {{ end }}
</div> </ul>
<div class="taxo-root"> <div class="taxo-root">
{{ partial "taxonomy/taxonomy-tags" . }} {{ partial "taxonomy/taxonomy-tags" . }}
{{ partial "taxonomy/taxonomy-categories" . }} {{ partial "taxonomy/taxonomy-categories" . }}