From 366e1a2f2c4aad0f9029c9abfc494efe2c0ba005 Mon Sep 17 00:00:00 2001 From: zzossig Date: Wed, 19 Feb 2020 10:29:45 +0900 Subject: [PATCH] [new feature] another lists in the sidebar Added new option `enableSidebarPostsByOrder` in params.toml file --- README.ko.md | 1 + README.md | 1 + exampleSite/config/_default/params.toml | 1 + .../partials/sidebar/list/posts-by-order.html | 18 ++++++++++++++++++ layouts/partials/sidebar/sidebar-home.html | 1 + layouts/partials/sidebar/sidebar-list.html | 2 ++ layouts/partials/taxonomy/taxonomy-tags.html | 2 +- 7 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 layouts/partials/sidebar/list/posts-by-order.html diff --git a/README.ko.md b/README.ko.md index 786b90b..7bc119f 100644 --- a/README.ko.md +++ b/README.ko.md @@ -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 diff --git a/README.md b/README.md index 120e68b..52b8ec6 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index c23a47c..7f548e7 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -61,6 +61,7 @@ enableTocSwitch = true itemsPerCategory = 5 sidebarPosition = "right" tocLevels = ["h2", "h3", "h4"] +enableSidebarPostsByOrder = false # footer showPoweredBy = true diff --git a/layouts/partials/sidebar/list/posts-by-order.html b/layouts/partials/sidebar/list/posts-by-order.html new file mode 100644 index 0000000..7cd3866 --- /dev/null +++ b/layouts/partials/sidebar/list/posts-by-order.html @@ -0,0 +1,18 @@ +{{ if ($.Param "enableSidebarPostsByOrder" | default false) }} + {{ $filteredSections := .Site.Pages }} + {{ range $.Param "notAllowedTypesInHomeSidebar" }} + {{ $filteredSections = (where $filteredSections "Type" "!=" (lower .)) }} + {{ end }} + + + + +{{ end }} \ No newline at end of file diff --git a/layouts/partials/sidebar/sidebar-home.html b/layouts/partials/sidebar/sidebar-home.html index 6cfb50a..71f5519 100644 --- a/layouts/partials/sidebar/sidebar-home.html +++ b/layouts/partials/sidebar/sidebar-home.html @@ -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 }} diff --git a/layouts/partials/sidebar/sidebar-list.html b/layouts/partials/sidebar/sidebar-list.html index a89c63f..62d846d 100644 --- a/layouts/partials/sidebar/sidebar-list.html +++ b/layouts/partials/sidebar/sidebar-list.html @@ -3,6 +3,8 @@