Skip to content

Commit 1836b6a

Browse files
authored
DOCS-3412: Show left nav for tutorials and hidden pages (#3884)
1 parent 256091e commit 1836b6a

File tree

5 files changed

+51
-20
lines changed

5 files changed

+51
-20
lines changed

assets/scss/_styles_project.scss

+11-2
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,11 @@ a > code {
232232
color: #333333 !important;
233233
}
234234

235-
.nav-fold * #TableOfContents ul li ul {
235+
#TableOfContents ul li ul {
236236
padding: 0;
237237
}
238238

239-
.nav-fold * #TableOfContents ul li ul.is-collapsed {
239+
#TableOfContents ul li ul.is-collapsed {
240240
display: none;
241241
}
242242

@@ -2856,6 +2856,15 @@ a.tree-root {
28562856

28572857
// Top level nav END
28582858

2859+
// For tutorials, make side nav heading smaller
2860+
2861+
li.active-path.tutorial-heading > a {
2862+
color: #0000EA;
2863+
margin-top: 1rem;
2864+
font-size: 0.833rem;
2865+
font-weight: 600;
2866+
}
2867+
28592868
// Next page START
28602869

28612870
#next-page {

docs/dev/contributing.md docs/dev/reference/contributing.md

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ weight: 99
55
type: "docs"
66
description: "Learn about our style guide and how to work with hugo to contribute to these docs."
77
toc_hide: true
8+
aliases:
9+
- /dev/contributing/
810
---
911

1012
Thank you for wanting to help us make the docs better.

docs/dev/tools/tutorials.md

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ sitemap:
2222
priority: 1.0
2323
aliases:
2424
- /build/
25+
- /tutorials/
2526
outputs:
2627
- rss
2728
- html

docs/tutorials/_index.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ title: "Tutorials"
33
linkTitle: "Tutorials"
44
weight: 300
55
type: docs
6-
layout: "tutorials"
7-
hide_children: true
6+
layout: "empty"
87
sitemap:
98
priority: 1.0
10-
hidden: true
9+
toc_hide: false
1110
outputs:
1211
- rss
1312
- html

layouts/partials/sidebar-tree.html

+35-15
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,30 @@
4343
{{ $activePath := and (not $shouldDelayActive) (or ($p.IsDescendant $s) (eq $p $s)) -}}
4444
{{ $show := cond (or (lt $ulNr $ulShow) $activePath (and (not $shouldDelayActive) (eq $s.Parent $p.Parent)) (and (not $shouldDelayActive) (eq $s.Parent $p)) (not $p.Site.Params.ui.sidebar_menu_compact) (and (not $shouldDelayActive) ($p.IsDescendant $s.Parent))) true false -}}
4545
{{ $mid := printf "m-%s" ($s.RelPermalink | anchorize) -}}
46-
{{ $pages_tmp := where (union $s.Pages $s.Sections).ByWeight ".Params.toc_hide" "!=" true -}}
46+
{{ $pages_tmp := (union $s.Pages $s.Sections).ByWeight -}}
4747
{{ $pages := $pages_tmp | first $sidebarMenuTruncate -}}
4848
{{ $withChild := gt (len $pages) 0 -}}
4949
{{ $hideChildren := cond (isset $s.Params "hide_children") true false -}}
5050
{{ $manualLink := cond (isset $s.Params "manuallink") $s.Params.manualLink ( cond (isset $s.Params "manuallinkrelref") (relref $s $s.Params.manualLinkRelref) $s.RelPermalink) -}}
5151
{{ $manualLinkTitle := cond (isset $s.Params "manuallinktitle") $s.Params.manualLinkTitle $s.Title -}}
5252
{{ $empty_node := $s.Params.empty_node -}}
53+
{{ $toc_hide := $s.Params.toc_hide -}}
5354
{{ $openOnDesk := $s.Params.open_on_desktop }}
5455
{{ $headerOnly := $s.Params.header_only }}
56+
57+
{{ if eq $p.Section "tutorials"}}
58+
<!-- If this is a tutorial -->
59+
<a href="/dev/tools/tutorials/" target="{{ . }}" rel="noopener" class="">
60+
<span> Tutorials </span>
61+
</a>
62+
<li class="active-path tutorial-heading">
63+
<a href="" title="{{ $p.Title }}" class="active">{{ $p.LinkTitle }}
64+
</a>
65+
<div class="td-toc" id="TableOfContents"></div>
66+
</li>
67+
{{ else }}
68+
69+
{{ if or ( or (not $toc_hide) ($activePath) ) $active }}
5570
<li class="{{ if $withChild }}nav-fold{{ end }}{{ if $activePath }} active-path{{ else }}{{ if $p.Parent }} hide-if-desktop{{ end }}{{ end }}{{ if (not (or $show $p.Site.Params.ui.sidebar_menu_foldable )) }} {{ if not $activePath }}collapse{{ end }}{{ end }}{{ if $empty_node }} empty-node-submenu{{ end }}{{if $s.Params.menuindent }} indent{{ end }}{{ if $openOnDesk }} open-on-desktop{{ end }}{{ if $headerOnly }} header-only{{ end }}" >
5671
{{ if (and $p.Site.Params.ui.sidebar_menu_foldable (ge $ulNr 1)) -}}
5772
<input type="checkbox" id="{{ $mid }}-check"{{ if $activePath}} checked{{ end }}/>
@@ -60,20 +75,23 @@
6075
{{ else -}}
6176
{{- if $withChild }}
6277
<span>
63-
{{ if $empty_node }}
64-
<!-- IF EMPTY NODE WITH CHILDREN -->
65-
<span class="emptynode {{ if $active}}active{{ end }} {{ if $treeRoot }} tree-root{{ end }}">{{ $s.LinkTitle }}</span>
66-
{{ else }}
67-
{{ if not (eq $s.LinkTitle "Tutorials") }}
68-
<a href="{{ $manualLink }}"{{ if ne $s.LinkTitle $manualLinkTitle }} title="{{ $manualLinkTitle }}"{{ end }}{{ with $s.Params.manualLinkTarget }} target="{{ . }}"{{ if eq . "_blank" }} rel="noopener"{{ end }}{{ end }} class="{{ if $active}} active{{ end }}{{ if $treeRoot }} tree-root{{ end }}">
69-
{{ if $s.Params.overview }}
70-
<span class="section-overview"> Overview </span><span class="section-overview-title"> {{ $s.LinkTitle }} </span>
78+
{{ if or (not $toc_hide) ($activePath)}}
79+
{{ if $empty_node }}
80+
<!-- IF EMPTY NODE WITH CHILDREN -->
81+
<span class="emptynode {{ if $active}}active{{ end }} {{ if $treeRoot }} tree-root{{ end }}">{{ $s.LinkTitle }}</span>
82+
{{ else }}
83+
{{ if not (eq $s.LinkTitle "Tutorials") }}
84+
<a href="{{ $manualLink }}"{{ if ne $s.LinkTitle $manualLinkTitle }} title="{{ $manualLinkTitle }}"{{ end }}{{ with $s.Params.manualLinkTarget }} target="{{ . }}"{{ if eq . "_blank" }} rel="noopener"{{ end }}{{ end }} class="{{ if $active}} active{{ end }}{{ if $treeRoot }} tree-root{{ end }}">
85+
{{ if $s.Params.overview }}
86+
<span class="section-overview"> Overview </span><span class="section-overview-title"> {{ $s.LinkTitle }} </span>
87+
{{ else }}
88+
<span> {{ $s.LinkTitle }} </span>
89+
{{ end }}
90+
{{ if $s.Params.canonical }}<i class="fas fa-external-link-alt fa-sm"></i>{{ end }}
91+
</a>
7192
{{ else }}
72-
<span> {{ $s.LinkTitle }} </span>
7393
{{ end }}
74-
{{ if $s.Params.canonical }}<i class="fas fa-external-link-alt fa-sm"></i>{{ end }}
75-
</a>
76-
{{ end }}
94+
{{- end }}
7795
{{- end }}
7896
{{- if (or (and $withChild (not $treeRoot) ) (not $hideChildren) ) }}
7997
{{- if (or $hideChildren $treeRoot) -}}
@@ -104,7 +122,7 @@
104122
{{ end }}
105123
{{- end }}
106124
{{- if $withChild }}
107-
{{- if $hideChildren -}}
125+
{{- if and ($hideChildren) (not $activePath) -}}
108126
{{- else -}}
109127
{{- $ulNr := add $ulNr 1 }}
110128
<ul class="ul-{{ $ulNr }}">
@@ -115,4 +133,6 @@
115133
{{- end }}
116134
{{- end }}
117135
</li>
118-
{{- end }}
136+
{{- end }}
137+
{{- end }}
138+
{{- end}}

0 commit comments

Comments
 (0)