Skip to content
This repository was archived by the owner on Mar 1, 2024. It is now read-only.

Commit 8d3309b

Browse files
Add support for pre elements in drawer
1 parent 25a251b commit 8d3309b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

exampleSite/content/getting-started/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,10 @@ Once you created your first content files you can link them manually in the side
206206
name = "Material"
207207
url = "/"
208208
weight = 0
209+
pre = ""
209210
```
210211

211-
`name` is the title displayed in the menu and `url` the relative URL to the content. The `weight` attribute allows you to modify the order of the menu entries. A menu entry appears further down the more weight you add.
212+
`name` is the title displayed in the menu and `url` the relative URL to the content. The `weight` attribute allows you to modify the order of the menu entries. A menu entry appears further down the more weight you add. The `pre` attribute is optional and allows you to *pre*pend elements to a menu link, e.g. an icon.
212213

213214
Instead of just linking a single file you can enhance the sidebar by creating a nested menu. This way you can list all pages of a section instead of linking them one by one (without nesting).
214215

layouts/partials/nav_link.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{{ $currentMenuEntry := .Scratch.Get "currentMenuEntry" }}
22
{{ $isCurrent := eq .Permalink ($currentMenuEntry.URL | absURL | printf "%s") }}
33

4+
45
<a {{ if $isCurrent }}class="current"{{ end }} title="{{ $currentMenuEntry.Name }}" href="{{ $currentMenuEntry.URL | absURL }}">
6+
{{ $currentMenuEntry.Pre }}
57
{{ $currentMenuEntry.Name }}
68
</a>
79

0 commit comments

Comments
 (0)