mirror of
https://github.com/alex-shpak/hugo-book.git
synced 2024-11-25 12:46:44 +00:00
#51, Add experimental bookCollapseSection page param to hide nested sections
This commit is contained in:
parent
071e069d92
commit
e2188136e1
@ -179,6 +179,9 @@ weight = 10
|
||||
# (Optional) Set to mark page as flat section in file-tree menu (if BookMenuBundle not set)
|
||||
bookFlatSection = true
|
||||
|
||||
# (Optional, Experimental) Set to hide nested sections or pages at that level. Works only with file-tree menu mode
|
||||
bookCollapseSection = true
|
||||
|
||||
# (Optional) Set true to hide page or section from side menu (if BookMenuBundle not set)
|
||||
bookHidden = true
|
||||
|
||||
@ -201,9 +204,10 @@ There are few empty partials you can override in `layouts/partials/`
|
||||
### Extra Customisation
|
||||
|
||||
| File | Description |
|
||||
| --------------------- | ------------------------------------------------------------------------------------- |
|
||||
| ------------------------ | ------------------------------------------------------------------------------------- |
|
||||
| `static/favicon.png` | Override default favicon |
|
||||
| `assets/_custom.scss` | Customise or override scss styles |
|
||||
| `assets/_variables.scss` | Override default SCSS variables |
|
||||
| `assets/_fonts.scss` | Replace default font with custom fonts (e.g. local files or remote like google fonts) |
|
||||
|
||||
### Hugo Internal Templates
|
||||
|
@ -26,7 +26,7 @@ pygmentsCodeFences = true
|
||||
|
||||
# (Optional, default none) Set leaf bundle to render as side menu
|
||||
# When not specified file structure and weights will be used
|
||||
BookMenuBundle = '/menu'
|
||||
# BookMenuBundle = '/menu'
|
||||
|
||||
# (Optional, default docs) Specify section of content to render as menu
|
||||
# You can also set value to '*' to render all sections to menu
|
||||
|
@ -16,17 +16,17 @@ pygmentsCodeFences: true
|
||||
|
||||
params:
|
||||
# (Optional, default 6) Set how many table of contents levels to be showed on page.
|
||||
# Use false/off to hide ToC, note that 0 will default to 6 (https://gohugo.io/functions/default/)
|
||||
# Use false to hide ToC, note that 0 will default to 6 (https://gohugo.io/functions/default/)
|
||||
# You can also specify this parameter per page in front matter
|
||||
BookToC: 3
|
||||
|
||||
# (Optional, default none) Set the path to a logo for the book. If the logo is
|
||||
# /static/logo.png then the path would be /logo.png
|
||||
# /static/logo.png then the path would be logo.png
|
||||
# BookLogo: /logo.png
|
||||
|
||||
# (Optional, default none) Set leaf bundle to render as side menu
|
||||
# When not specified file structure and weights will be used
|
||||
BookMenuBundle: /menu
|
||||
# BookMenuBundle: /menu
|
||||
|
||||
# (Optional, default docs) Specify section of content to render as menu
|
||||
# You can also set value to '*' to render all sections to menu
|
||||
|
@ -0,0 +1 @@
|
||||
# 5th
|
@ -0,0 +1,26 @@
|
||||
# Locus fuit caecis
|
||||
|
||||
Nefas discordemque domino montes numen tum humili nexilibusque exit, Iove. Quae
|
||||
miror esse, scelerisque Melaneus viribus. Miseri laurus. Hoc est proposita me
|
||||
ante aliquid, aura inponere candidioribus quidque accendit bella, sumpta.
|
||||
Intravit quam erat figentem hunc, motus de fontes parvo tempestate.
|
||||
|
||||
iscsi_virus = pitch(json_in_on(eupViral),
|
||||
northbridge_services_troubleshooting, personal(
|
||||
firmware_rw.trash_rw_crm.device(interactive_gopher_personal,
|
||||
software, -1), megabit, ergonomicsSoftware(cmyk_usb_panel,
|
||||
mips_whitelist_duplex, cpa)));
|
||||
if (5) {
|
||||
managementNetwork += dma - boolean;
|
||||
kilohertz_token = 2;
|
||||
honeypot_affiliate_ergonomics = fiber;
|
||||
}
|
||||
mouseNorthbridge = byte(nybble_xmp_modem.horse_subnet(
|
||||
analogThroughputService * graphicPoint, drop(daw_bit, dnsIntranet),
|
||||
gateway_ospf), repository.domain_key.mouse(serverData(fileNetwork,
|
||||
trim_duplex_file), cellTapeDirect, token_tooltip_mashup(
|
||||
ripcordingMashup)));
|
||||
module_it = honeypot_driver(client_cold_dvr(593902, ripping_frequency) +
|
||||
coreLog.joystick(componentUdpLink), windows_expansion_touchscreen);
|
||||
bashGigabit.external.reality(2, server_hardware_codec.flops.ebookSampling(
|
||||
ciscNavigationBacklink, table + cleanDriver), indexProtocolIsp);
|
@ -0,0 +1,22 @@
|
||||
---
|
||||
bookCollapseSection: true
|
||||
---
|
||||
|
||||
# Caput vino delphine in tamen vias
|
||||
|
||||
## Cognita laeva illo fracta
|
||||
|
||||
Lorem markdownum pavent auras, surgit nunc cingentibus libet **Laomedonque que**
|
||||
est. Pastor [An](http://est.org/ire.aspx) arbor filia foedat, ne [fugit
|
||||
aliter](http://www.indiciumturbam.org/moramquid.php), per. Helicona illas et
|
||||
callida neptem est *Oresitrophos* caput, dentibus est venit. Tenet reddite
|
||||
[famuli](http://www.antro-et.net/) praesentem fortibus, quaeque vis foret si
|
||||
frondes *gelidos* gravidae circumtulit [inpulit armenta
|
||||
nativum](http://incurvasustulit.io/illi-virtute.html).
|
||||
|
||||
1. Te at cruciabere vides rubentis manebo
|
||||
2. Maturuit in praetemptat ruborem ignara postquam habitasse
|
||||
3. Subitarum supplevit quoque fontesque venabula spretis modo
|
||||
4. Montis tot est mali quasque gravis
|
||||
5. Quinquennem domus arsit ipse
|
||||
6. Pellem turis pugnabant locavit
|
@ -11,12 +11,12 @@
|
||||
{{/* If there is only one section to render then render its children, else render all sections */}}
|
||||
{{ if eq (len $sections) 1 }}
|
||||
{{ with index $sections 0 }}
|
||||
{{ template "book-section-children" (dict "Section" . "CurrentPage" $.Permalink) }}
|
||||
{{ template "book-section-children" (dict "Section" . "CurrentPage" $) }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<ul>
|
||||
{{ range where $sections "Params.bookhidden" "!=" true }}
|
||||
{{ template "book-section" (dict "Section" . "CurrentPage" $.Permalink) }}
|
||||
{{ template "book-section" (dict "Section" . "CurrentPage" $) }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
@ -36,6 +36,10 @@
|
||||
{{ end }}
|
||||
|
||||
{{ define "book-section-children" }}
|
||||
{{ $ancestor := .Section.IsAncestor .CurrentPage }}
|
||||
{{ $collapsed := .Section.Params.bookCollapseSection }}
|
||||
|
||||
{{ if or $ancestor (not $collapsed) }}
|
||||
{{ with .Section }}
|
||||
<ul>
|
||||
{{ range where .Pages "Params.bookhidden" "!=" "true" }}
|
||||
@ -51,9 +55,11 @@
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
|
||||
{{ define "book-page-link" }}
|
||||
{{ with .Page }}
|
||||
<a href="{{ .RelPermalink }}" {{ if eq $.CurrentPage .Permalink }} class="active"{{ end }}>
|
||||
<a href="{{ .RelPermalink }}" {{ if eq $.CurrentPage . }} class="active"{{ end }}>
|
||||
{{ partial "docs/title" . }}
|
||||
</a>
|
||||
{{ end }}
|
||||
|
Loading…
Reference in New Issue
Block a user