Skip to content

Commit

Permalink
feat: add the site parameter sidebar.taxonomiesToggleArchives
Browse files Browse the repository at this point in the history
Fixed #713
  • Loading branch information
razonyang committed Sep 15, 2022
1 parent caf131d commit 300f2c9
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions exampleSite/config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ viewer = true # Image Viewer
# fixed = true
# archives = true # Enable archives widget
# taxonomiesToggle = false # Disable taxonomy toggle
# taxonomiesToggleArchives = false # Don't show the archives on taxonomies toggle widget.
# categories = true # Enable categories widget
# tags = true # Enable tags widget
# series = true # Enable series widget
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ The site parameters are located in `config/_default/params.toml` by default.
| `sidebar` | Object | - |
| `sidebar.fixed` | Boolean | `false` | Fix default sidebar.
| `sidebar.taxonomiesToggle` | Boolean | `true` | Show the taxonomies toggle widget on the sidebar.
| `sidebar.taxonomiesToggleArchives` | Boolean | `true` | Show/Hide the archives from the taxonomies toggle.
| `sidebar.series` | Boolean | `false` | Show the series widget on the sidebar.
| `sidebar.categories` | Boolean | `false` | Show the categories widget on the sidebar.
| `sidebar.tags` | Boolean | `false` | Show the tags widget on the sidebar.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ authors = ["RazonYang"]
| `sidebar` | Object | - |
| `sidebar.fixed` | Boolean | `false` | 固定默认侧边栏。
| `sidebar.taxonomiesToggle` | Boolean | `true` | Show the taxonomies toggle widget on the sidebar.
| `sidebar.taxonomiesToggleArchives` | Boolean | `true` | Show/Hide the archives from the taxonomies toggle.
| `sidebar.series` | Boolean | `false` | Show the series widget on the sidebar.
| `sidebar.categories` | Boolean | `false` | Show the categories widget on the sidebar.
| `sidebar.tags` | Boolean | `false` | Show the tags widget on the sidebar.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ authors = ["RazonYang"]
| `sidebar` | Object | - |
| `sidebar.fixed` | Boolean | `false` | 固定默認側邊欄。
| `sidebar.taxonomiesToggle` | Boolean | `true` | Show the taxonomies toggle widget on the sidebar.
| `sidebar.taxonomiesToggleArchives` | Boolean | `true` | Show/Hide the archives from the taxonomies toggle.
| `sidebar.series` | Boolean | `false` | Show the series widget on the sidebar.
| `sidebar.categories` | Boolean | `false` | Show the categories widget on the sidebar.
| `sidebar.tags` | Boolean | `false` | Show the tags widget on the sidebar.
Expand Down
5 changes: 5 additions & 0 deletions layouts/partials/sidebar/taxonomies-toggle.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- $collapsed := default false .Site.Params.sidebar.collapsed }}
{{- if default true .Site.Params.sidebar.taxonomiesToggle }}
{{- $archives := default true $.Site.Params.sidebar.taxonomiesToggleArchives }}
<div class="accordion taxonomies-toggle">
<section class="row card component accordion-item">
<div class="accordion-header card-header border-0">
Expand Down Expand Up @@ -32,12 +33,14 @@
{{- end }}
{{- end }}
{{- end }}
{{- if $archives }}
<li class="nav-item" role="presentation">
<button class="nav-link" id="taxonomyArchivesTab" data-bs-toggle="tab" data-bs-target="#taxonomyArchive"
type="button" role="tab" aria-controls="taxonomyArchives" aria-selected="true">
{{ i18n "archives" }}
</button>
</li>
{{- end }}
</ul>

<div class="tab-content mt-3">
Expand Down Expand Up @@ -76,9 +79,11 @@
{{- end }}
{{- end }}
{{- end }}
{{- if $archives }}
<div class="tab-pane" id="taxonomyArchive" role="tabpanel" aria-labelledby="taxonomyArchiveTab" tabindex="0">
{{- partial "sidebar/archive-items" . }}
</div>
{{- end }}
</div>
</div>
</section>
Expand Down

0 comments on commit 300f2c9

Please sign in to comment.