forked from drowl87/hextra_mirror
feat: multi-level sidebar
chore: support multiple search elements chore: sidebar display toc on mobile view chore: add hamburger menu to navbar on mobile chore: add markdown link hook for opening external link in new window chore: add sidebar footer - put search under params.type - make navbar link aware of external link
This commit is contained in:
@ -11,18 +11,30 @@
|
||||
|
||||
{{- $currentPage := . -}}
|
||||
{{- range .Site.Menus.main -}}
|
||||
{{- if eq .Name "Search" -}}
|
||||
{{- if eq .Params.type "search" -}}
|
||||
{{ partial "search.html" (dict "params" .Params) }}
|
||||
{{- else if .Params.icon -}}
|
||||
<a class="p-2 text-current" target="_blank" rel="noreferer" href="{{ .URL }}">
|
||||
{{ partial "utils/icon.html" (dict "name" .Params.icon "attributes" "height=24") }}
|
||||
<span class="sr-only">{{ .Name }}</span>
|
||||
</a>
|
||||
{{ else }}
|
||||
<a class="text-sm contrast-more:text-gray-700 contrast-more:dark:text-gray-100 relative -ml-2 hidden whitespace-nowrap p-2 md:inline-block text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200" href="{{ .URL }}">
|
||||
<span class="text-center">{{ .Name }}</span>
|
||||
</a>
|
||||
{{- else -}}
|
||||
{{ $external := strings.HasPrefix .URL "http" }}
|
||||
{{- if .Params.icon -}}
|
||||
<a class="p-2 text-current" {{ if $external }}target="_blank" rel="noreferer"{{ end }} href="{{ .URL | safeURL }}">
|
||||
{{ partial "utils/icon.html" (dict "name" .Params.icon "attributes" "height=24") }}
|
||||
<span class="sr-only">{{ .Name }}</span>
|
||||
</a>
|
||||
{{- else -}}
|
||||
<a
|
||||
href="{{ .URL | safeURL }}"
|
||||
{{ if $external }}target="_blank" rel="noreferer"{{ end }}
|
||||
class="text-sm contrast-more:text-gray-700 contrast-more:dark:text-gray-100 relative -ml-2 hidden whitespace-nowrap p-2 md:inline-block text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200"
|
||||
>
|
||||
<span class="text-center">{{ .Name }}</span>
|
||||
</a>
|
||||
{{- end -}}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
<button type="button" aria-label="Menu" class="hamburger-menu -mr-2 rounded p-2 active:bg-gray-400/20 md:hidden">
|
||||
{{ partial "utils/icon.html" (dict "name" "menu" "attributes" "height=24") }}
|
||||
</button>
|
||||
</nav>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user