[new feature] another lists in the sidebar

Added new option `enableSidebarPostsByOrder` in params.toml file
This commit is contained in:
zzossig 2020-02-19 10:29:45 +09:00
parent 97d73a5e96
commit 366e1a2f2c
7 changed files with 25 additions and 1 deletions

View File

@ -287,6 +287,7 @@ 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
tocLevels = ["h2", "h3", "h4"] # minimum h2, maximum h4 in your article
enableSidebarPostsByOrder = false # another lists in the sidebar
# footer
showPoweredBy = true # show footer text: Powered by Hugo and Zzo theme

View File

@ -295,6 +295,7 @@ 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
tocLevels = ["h2", "h3", "h4"] # minimum h2, maximum h4 in your article
enableSidebarPostsByOrder = false # another lists in the sidebar
# footer
showPoweredBy = true # show footer text: Powered by Hugo and Zzo theme

View File

@ -61,6 +61,7 @@ enableTocSwitch = true
itemsPerCategory = 5
sidebarPosition = "right"
tocLevels = ["h2", "h3", "h4"]
enableSidebarPostsByOrder = false
# footer
showPoweredBy = true

View File

@ -0,0 +1,18 @@
{{ if ($.Param "enableSidebarPostsByOrder" | default false) }}
{{ $filteredSections := .Site.Pages }}
{{ range $.Param "notAllowedTypesInHomeSidebar" }}
{{ $filteredSections = (where $filteredSections "Type" "!=" (lower .)) }}
{{ end }}
<div class="sidebar-recent__title p2">{{ i18n "posts-by-param" | default "TOP POSTS" }}</div>
<ul class="sidebar-recent__ul">
{{ range first ($.Param "itemsPerCategory") ($filteredSections.ByParam "order") }}
{{ if .Params.order }}
<li>
<a href="{{ .RelPermalink }}" class="sidebar-recent__a p2">{{ .Title }}</a>
</li>
{{ end }}
{{ end }}
</ul>
<hr class="hr-fade sidebar-hr" />
{{ end }}

View File

@ -3,6 +3,7 @@
{{ partial "search/site-search" . }}
{{ partial "sidebar/site-bio" . }}
{{ partial "sidebar/custom-home" . }}
{{ partial "sidebar/list/posts-by-order" . }}
{{ if and ($.Param "itemsPerCategory") ($.Param "enableHomeSidebarTitles") }}
{{ $filteredSections := .Site.Sections }}

View File

@ -3,6 +3,8 @@
<ul class="sidebar">
{{ partial "search/site-search" . }}
{{ partial "sidebar/custom-list" . }}
{{ partial "sidebar/list/posts-by-order" . }}
{{ if and ($.Param "itemsPerCategory") ($.Param "enableListSidebarTitles") }}
{{ range first ($.Param "itemsPerCategory") .Pages }}
<li class="sidebar-recent">

View File

@ -1,4 +1,4 @@
{{ if $.Param "enableSidebarTags" }}
{{ if and ($.Param "enableSidebarTags") (ne (len .Site.Taxonomies.tags) 0) }}
<div class="taxo">
<section>
<span class="title p2">