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
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
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.
enableSidebarSeries = true
enableSidebarCategories = true
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

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
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
homeHeaderType = "text" # text, img, slide
@ -254,10 +255,10 @@ link = "https://github.com/zzossig/hugo-theme-zzo"
# sidebar
enableBio = true # home page sidebar
enableSidebar = true # Set to false to create the full width of the content.
enableSidebarTitles = true
enableSidebarTags = true # if you want to use tags.
enableSidebarSeries = true
enableSidebarCategories = true
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

View File

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

View File

@ -3,11 +3,13 @@
margin-right: 1rem;
&-recent {
padding: 0.5rem;
padding: 0.25rem;
&__title {
font-family: $title-font;
font-weight: 700;
font-size: 0.95rem;
@include themify($themes) {
color: themed('sidebar-title-color');
&:hover {
@ -17,12 +19,12 @@
}
&__ul {
margin-left: 0.5rem;
margin-left: 0.25rem;
li {
text-indent: -0.35em;
text-indent: -0.4em;
padding-left: 0.5em;
&::before {
padding-right: 0.5rem;
padding-right: 0.125rem;
font-size: 1rem;
display: inline-block;
content: "\2022";
@ -30,7 +32,8 @@
}
}
&__a {
&__a {
font-size: 0.95rem;
@include themify($themes) {
color: themed('sidebar-li-color');
}
@ -40,4 +43,15 @@
&-hr {
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"]
notAllowedTypesInHome = ["contact", "talks", "about"]
notAllowedTypesInHomeSidebar = ["about", "archive"]
# header
homeHeaderType = "text" # text, img, slide
@ -40,6 +41,7 @@ enableSidebar = true
enableSidebarTags = true
enableSidebarSeries = true
enableSidebarCategories = true
enableHomeSidebarTitles = true
enableListSidebarTitles = true
enableToc = true
hideToc = false

View File

@ -1,25 +1,31 @@
{{ if $.Param "enableSidebar" }}
<div class="sidebar">
{{ partial "search/site-search" . }}
{{ partial "sidebar/site-bio" . }}
{{ partial "sidebar/site-bio" . }}
{{ partial "sidebar/custom-home" . }}
{{ range (and (where .Site.Sections "Type" "!=" "about") (where .Site.Sections "Type" "!=" "archive")) }}
<section class="sidebar-recent">
<a href="{{ .RelPermalink }}" class="sidebar-recent__title p2">{{ .Title }}</a>
<ul class="sidebar-recent__ul">
{{ if .Site.Params.itemsPerCategory }}
{{ range first .Site.Params.itemsPerCategory .Pages }}
<li><a href="{{ .RelPermalink }}" class="sidebar-recent__a p2">{{ .Title }}</a>
</li>
{{ end }}
{{ end }}
</ul>
</section>
{{ 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">
<a href="{{ .RelPermalink }}" class="sidebar-recent__title p2">{{ .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>
{{ end }}
</ul>
</section>
<hr class="hr-fade sidebar-hr" />
{{ end }}
{{ end }}
</div>
<hr class="hr-fade sidebar-hr" />
<div class="taxo-root">
{{ partial "taxonomy/taxonomy-tags" . }}
{{ partial "taxonomy/taxonomy-categories" . }}

View File

@ -1,23 +1,17 @@
{{ if $.Param "enableSidebar" }}
<div class="sidebar">
<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 }}
<section class="sidebar-recent">
<li class="sidebar-recent">
<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>
{{ end }}
</ul>
</section>
</li>
{{ end }}
<hr class="hr-fade sidebar-hr" />
{{ end }}
</div>
</ul>
<div class="taxo-root">
{{ partial "taxonomy/taxonomy-tags" . }}
{{ partial "taxonomy/taxonomy-categories" . }}