Skip to content

Commit b01c8ee

Browse files
committed
chore: add example sidebar data file
- update docs - replace original sidebar template with new sidebar template - update references names
1 parent 2acfb3b commit b01c8ee

File tree

16 files changed

+147
-353
lines changed

16 files changed

+147
-353
lines changed

assets/css/compiled/main.css

Lines changed: 0 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -860,9 +860,6 @@ video {
860860
.hx-justify-center {
861861
justify-content: center;
862862
}
863-
.hx-justify-between {
864-
justify-content: space-between;
865-
}
866863
.hx-justify-items-start {
867864
justify-items: start;
868865
}
@@ -1028,10 +1025,6 @@ video {
10281025
--tw-bg-opacity: 1;
10291026
background-color: rgb(255 247 237 / var(--tw-bg-opacity));
10301027
}
1031-
.hx-bg-primary-100 {
1032-
--tw-bg-opacity: 1;
1033-
background-color: hsl(var(--primary-hue) var(--primary-saturation) calc(var(--primary-lightness) + calc(calc(100% - var(--primary-lightness)) / 50) * 44) / var(--tw-bg-opacity));
1034-
}
10351028
.hx-bg-primary-400 {
10361029
--tw-bg-opacity: 1;
10371030
background-color: hsl(var(--primary-hue) var(--primary-saturation) calc(var(--primary-lightness) + calc(calc(100% - var(--primary-lightness)) / 50) * 16) / var(--tw-bg-opacity));
@@ -1311,10 +1304,6 @@ video {
13111304
--tw-text-opacity: 1;
13121305
color: rgb(154 52 18 / var(--tw-text-opacity));
13131306
}
1314-
.hx-text-primary-800 {
1315-
--tw-text-opacity: 1;
1316-
color: hsl(var(--primary-hue) var(--primary-saturation) calc(calc(var(--primary-lightness) / 50) * 32) / var(--tw-text-opacity));
1317-
}
13181307
.hx-text-red-900 {
13191308
--tw-text-opacity: 1;
13201309
color: rgb(127 29 29 / var(--tw-text-opacity));
@@ -2813,11 +2802,6 @@ body:is(html[class~="dark"] *) {
28132802
content: var(--tw-content);
28142803
inset: 0px;
28152804
}
2816-
.before\:hx-inset-y-1::before {
2817-
content: var(--tw-content);
2818-
top: 0.25rem;
2819-
bottom: 0.25rem;
2820-
}
28212805
.before\:hx-mr-1::before {
28222806
content: var(--tw-content);
28232807
margin-right: 0.25rem;
@@ -2826,37 +2810,16 @@ body:is(html[class~="dark"] *) {
28262810
content: var(--tw-content);
28272811
display: inline-block;
28282812
}
2829-
.before\:hx-w-px::before {
2830-
content: var(--tw-content);
2831-
width: 1px;
2832-
}
2833-
.before\:hx-bg-gray-200::before {
2834-
content: var(--tw-content);
2835-
--tw-bg-opacity: 1;
2836-
background-color: rgb(229 231 235 / var(--tw-bg-opacity));
2837-
}
2838-
.before\:hx-opacity-25::before {
2839-
content: var(--tw-content);
2840-
opacity: 0.25;
2841-
}
28422813
.before\:hx-transition-transform::before {
28432814
content: var(--tw-content);
28442815
transition-property: transform;
28452816
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
28462817
transition-duration: 150ms;
28472818
}
2848-
.before\:hx-content-\[\'\#\'\]::before {
2849-
--tw-content: '#';
2850-
content: var(--tw-content);
2851-
}
28522819
.before\:hx-content-\[\'\'\]::before {
28532820
--tw-content: '';
28542821
content: var(--tw-content);
28552822
}
2856-
.before\:hx-content-\[\\\"\\\"\]::before {
2857-
--tw-content: \"\";
2858-
content: var(--tw-content);
2859-
}
28602823
.first\:hx-mt-0:first-child {
28612824
margin-top: 0px;
28622825
}
@@ -3035,15 +2998,6 @@ body:is(html[class~="dark"] *) {
30352998
border-color: rgb(163 163 163 / var(--tw-border-opacity));
30362999
}
30373000

3038-
.contrast-more\:hx-border-primary-500 {
3039-
--tw-border-opacity: 1;
3040-
border-color: hsl(var(--primary-hue) var(--primary-saturation) calc(calc(var(--primary-lightness) / 50) * 50) / var(--tw-border-opacity));
3041-
}
3042-
3043-
.contrast-more\:hx-border-transparent {
3044-
border-color: transparent;
3045-
}
3046-
30473001
.contrast-more\:hx-font-bold {
30483002
font-weight: 700;
30493003
}
@@ -3082,11 +3036,6 @@ body:is(html[class~="dark"] *) {
30823036
--tw-shadow-colored: 0 0 #0000;
30833037
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
30843038
}
3085-
3086-
.contrast-more\:hover\:hx-border-gray-900:hover {
3087-
--tw-border-opacity: 1;
3088-
border-color: rgb(17 24 39 / var(--tw-border-opacity));
3089-
}
30903039
}
30913040
.dark\:hx-block:is(html[class~="dark"] *) {
30923041
display: block;
@@ -3172,9 +3121,6 @@ body:is(html[class~="dark"] *) {
31723121
.dark\:hx-bg-primary-300\/10:is(html[class~="dark"] *) {
31733122
background-color: hsl(var(--primary-hue) var(--primary-saturation) calc(var(--primary-lightness) + calc(calc(100% - var(--primary-lightness)) / 50) * 27) / 0.1);
31743123
}
3175-
.dark\:hx-bg-primary-400\/10:is(html[class~="dark"] *) {
3176-
background-color: hsl(var(--primary-hue) var(--primary-saturation) calc(var(--primary-lightness) + calc(calc(100% - var(--primary-lightness)) / 50) * 16) / 0.1);
3177-
}
31783124
.dark\:hx-bg-primary-600:is(html[class~="dark"] *) {
31793125
--tw-bg-opacity: 1;
31803126
background-color: hsl(var(--primary-hue) var(--primary-saturation) calc(calc(var(--primary-lightness) / 50) * 45) / var(--tw-bg-opacity));
@@ -3233,18 +3179,10 @@ body:is(html[class~="dark"] *) {
32333179
--tw-text-opacity: 1;
32343180
color: rgb(229 229 229 / var(--tw-text-opacity));
32353181
}
3236-
.dark\:hx-text-neutral-400:is(html[class~="dark"] *) {
3237-
--tw-text-opacity: 1;
3238-
color: rgb(163 163 163 / var(--tw-text-opacity));
3239-
}
32403182
.dark\:hx-text-orange-300:is(html[class~="dark"] *) {
32413183
--tw-text-opacity: 1;
32423184
color: rgb(253 186 116 / var(--tw-text-opacity));
32433185
}
3244-
.dark\:hx-text-primary-600:is(html[class~="dark"] *) {
3245-
--tw-text-opacity: 1;
3246-
color: hsl(var(--primary-hue) var(--primary-saturation) calc(calc(var(--primary-lightness) / 50) * 45) / var(--tw-text-opacity));
3247-
}
32483186
.dark\:hx-text-red-200:is(html[class~="dark"] *) {
32493187
--tw-text-opacity: 1;
32503188
color: rgb(254 202 202 / var(--tw-text-opacity));
@@ -3286,11 +3224,6 @@ body:is(html[class~="dark"] *) {
32863224
--tw-text-opacity: 1;
32873225
color: rgb(156 163 175 / var(--tw-text-opacity));
32883226
}
3289-
.dark\:before\:hx-bg-neutral-800:is(html[class~="dark"] *)::before {
3290-
content: var(--tw-content);
3291-
--tw-bg-opacity: 1;
3292-
background-color: rgb(38 38 38 / var(--tw-bg-opacity));
3293-
}
32943227
.dark\:before\:hx-invert:is(html[class~="dark"] *)::before {
32953228
content: var(--tw-content);
32963229
--tw-invert: invert(100%);
@@ -3406,11 +3339,6 @@ body:is(html[class~="dark"] *) {
34063339
border-color: rgb(163 163 163 / var(--tw-border-opacity));
34073340
}
34083341

3409-
.contrast-more\:dark\:hx-border-primary-500:is(html[class~="dark"] *) {
3410-
--tw-border-opacity: 1;
3411-
border-color: hsl(var(--primary-hue) var(--primary-saturation) calc(calc(var(--primary-lightness) / 50) * 50) / var(--tw-border-opacity));
3412-
}
3413-
34143342
.dark\:contrast-more\:hx-border-neutral-400:is(html[class~="dark"] *) {
34153343
--tw-border-opacity: 1;
34163344
border-color: rgb(163 163 163 / var(--tw-border-opacity));
@@ -3446,11 +3374,6 @@ body:is(html[class~="dark"] *) {
34463374
--tw-shadow-colored: 0 0 #0000;
34473375
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
34483376
}
3449-
3450-
.contrast-more\:dark\:hover\:hx-border-gray-50:hover:is(html[class~="dark"] *) {
3451-
--tw-border-opacity: 1;
3452-
border-color: rgb(249 250 251 / var(--tw-border-opacity));
3453-
}
34543377
}
34553378
@media not all and (min-width: 1280px) {
34563379

@@ -3598,9 +3521,6 @@ body:is(html[class~="dark"] *) {
35983521
.ltr\:hx-ml-1:where([dir="ltr"], [dir="ltr"] *) {
35993522
margin-left: 0.25rem;
36003523
}
3601-
.ltr\:hx-ml-3:where([dir="ltr"], [dir="ltr"] *) {
3602-
margin-left: 0.75rem;
3603-
}
36043524
.ltr\:hx-ml-auto:where([dir="ltr"], [dir="ltr"] *) {
36053525
margin-left: auto;
36063526
}
@@ -3650,10 +3570,6 @@ body:is(html[class~="dark"] *) {
36503570
.ltr\:hx-text-right:where([dir="ltr"], [dir="ltr"] *) {
36513571
text-align: right;
36523572
}
3653-
.ltr\:before\:hx-left-0:where([dir="ltr"], [dir="ltr"] *)::before {
3654-
content: var(--tw-content);
3655-
left: 0px;
3656-
}
36573573
@media (min-width: 768px) {
36583574

36593575
.ltr\:md\:hx-left-auto:where([dir="ltr"], [dir="ltr"] *) {
@@ -3675,9 +3591,6 @@ body:is(html[class~="dark"] *) {
36753591
.rtl\:hx-mr-1:where([dir="rtl"], [dir="rtl"] *) {
36763592
margin-right: 0.25rem;
36773593
}
3678-
.rtl\:hx-mr-3:where([dir="rtl"], [dir="rtl"] *) {
3679-
margin-right: 0.75rem;
3680-
}
36813594
.rtl\:hx-mr-auto:where([dir="rtl"], [dir="rtl"] *) {
36823595
margin-right: auto;
36833596
}
@@ -3721,10 +3634,6 @@ body:is(html[class~="dark"] *) {
37213634
.rtl\:hx-text-left:where([dir="rtl"], [dir="rtl"] *) {
37223635
text-align: left;
37233636
}
3724-
.rtl\:before\:hx-right-0:where([dir="rtl"], [dir="rtl"] *)::before {
3725-
content: var(--tw-content);
3726-
right: 0px;
3727-
}
37283637
.rtl\:before\:hx-rotate-180:where([dir="rtl"], [dir="rtl"] *)::before {
37293638
content: var(--tw-content);
37303639
--tw-rotate: 180deg;

exampleSite/content/docs/guide/configuration.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ params:
8787

8888
### Main Sidebar
8989

90-
For the main sidebar, it is automatically generated from the structure of the content directory.
90+
By default, the main sidebar is automatically generated from the structure of the content directory.
9191
See the [Organize Files](/docs/guide/organize-files) page for more details.
9292

9393
To exclude a single page from the left sidebar, set the `sidebar.exclude` parameter in the front matter of the page:
@@ -119,6 +119,33 @@ menu:
119119
weight: 3
120120
```
121121

122+
### Sidebar from Data
123+
124+
Alternatively, you can define the sidebar structure in the `data` directory. This gives you more flexibility to define sidebar differently than your content structure. To enable this, set the `params.sidebar.source` parameter in the config file to `data`:
125+
126+
```yaml {filename="hugo.yaml"}
127+
params:
128+
sidebar:
129+
source: data
130+
```
131+
132+
To define the sidebar data, create a file named `sidebar.yaml` in the `data` directory.
133+
134+
```yaml {filename="data/sidebar.yaml"}
135+
docs:
136+
- title: Documentation
137+
link: /docs/
138+
- title: Guide
139+
link: /docs/guide/
140+
open: false
141+
items:
142+
- title: Configuration
143+
link: /docs/guide/configuration/
144+
# ...
145+
```
146+
147+
If your site is multilingual, you can define the sidebar data for each language, for example in `data/en/sidebar.yaml` file.
148+
122149
## Right Sidebar
123150

124151
### Table of Contents

exampleSite/data/en/sidebar.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
docs:
2+
- title: Documentation
3+
link: /docs/
4+
- title: Getting Started
5+
link: /docs/getting-started/
6+
- title: Guide
7+
link: /docs/guide/
8+
open: false
9+
items:
10+
- title: Organize Files
11+
link: /docs/guide/organize-files/
12+
- title: Configuration
13+
link: /docs/guide/configuration/
14+
- title: Markdown
15+
link: /docs/guide/markdown/
16+
- title: Syntax Highlighting
17+
link: /docs/guide/syntax-highlighting/
18+
- title: LaTeX
19+
link: /docs/guide/latex/
20+
- title: Diagrams
21+
link: /docs/guide/diagrams/
22+
- title: Shortcodes
23+
link: /docs/guide/shortcodes/
24+
items:
25+
- title: Callout
26+
link: /docs/guide/shortcodes/callout/
27+
- title: Cards
28+
link: /docs/guide/shortcodes/cards/
29+
- title: Details
30+
link: /docs/guide/shortcodes/details/
31+
- title: FileTree
32+
link: /docs/guide/shortcodes/filetree/
33+
- title: Icon
34+
link: /docs/guide/shortcodes/icon/
35+
- title: Steps
36+
link: /docs/guide/shortcodes/steps/
37+
- title: Tabs
38+
link: /docs/guide/shortcodes/tabs/
39+
- title: Deploy Site
40+
link: /docs/guide/deploy-site/
41+
- title: Advanced
42+
link: /docs/advanced/
43+
items:
44+
- title: Multi-language
45+
link: /docs/advanced/multi-language/
46+
- title: Comments
47+
link: /docs/advanced/comments/
48+
- title: Customization
49+
link: /docs/advanced/customization/

exampleSite/hugo.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ params:
113113
# full (100%), wide (90rem), normal (1280px)
114114
width: normal
115115

116+
# TODO: move one level up
117+
sidebar:
118+
source: data
119+
116120
theme:
117121
# light | dark | system
118122
default: system

0 commit comments

Comments
 (0)