mirror of
https://github.com/thegeeklab/hugo-geekdoc.git
synced 2024-11-22 04:40:40 +00:00
feat: add option anchor the the bundle menu (#468)
This commit is contained in:
parent
17f56d8084
commit
1a9fe22d64
@ -60,6 +60,10 @@ main:
|
|||||||
ref: "/level-2/level-2-1"
|
ref: "/level-2/level-2-1"
|
||||||
- name: Level 2.2
|
- name: Level 2.2
|
||||||
ref: "/level-2/level-2-2"
|
ref: "/level-2/level-2-2"
|
||||||
|
- name: Level 2.2 Anchor
|
||||||
|
ref: /level-2/level-2-2
|
||||||
|
# Anchor to add to the entry. This example will result in `/level-2/level-2-2/#anchor`
|
||||||
|
anchor: anchor
|
||||||
```
|
```
|
||||||
|
|
||||||
As an advantage you can add [icons](/features/icon-sets/) to your menu entries e.g. `icon: "gdoc_notification"`.
|
As an advantage you can add [icons](/features/icon-sets/) to your menu entries e.g. `icon: "gdoc_notification"`.
|
||||||
|
@ -27,6 +27,11 @@
|
|||||||
{{ $id := substr (sha1 $this.Permalink) 0 8 }}
|
{{ $id := substr (sha1 $this.Permalink) 0 8 }}
|
||||||
{{ $doCollapse := and (isset . "sub") (or $this.Params.GeekdocCollapseSection (default false .Site.Params.GeekdocCollapseAllSections)) }}
|
{{ $doCollapse := and (isset . "sub") (or $this.Params.GeekdocCollapseSection (default false .Site.Params.GeekdocCollapseAllSections)) }}
|
||||||
|
|
||||||
|
{{ $anchor := default "" .anchor }}
|
||||||
|
{{ if $anchor }}
|
||||||
|
{{ $anchor = printf "#%s" $anchor }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ if or .external ($this.RelPermalink) }}
|
{{ if or .external ($this.RelPermalink) }}
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@ -50,7 +55,7 @@
|
|||||||
href="{{ if .external }}
|
href="{{ if .external }}
|
||||||
{{ .ref }}
|
{{ .ref }}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{ $this.RelPermalink }}
|
{{ path.Join $this.RelPermalink $anchor }}
|
||||||
{{- end }}"
|
{{- end }}"
|
||||||
class="gdoc-nav__entry{{- if not .external }}
|
class="gdoc-nav__entry{{- if not .external }}
|
||||||
{{- if $isCurrent }}{{ printf " is-active" }}{{ end }}
|
{{- if $isCurrent }}{{ printf " is-active" }}{{ end }}
|
||||||
|
Loading…
Reference in New Issue
Block a user