mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-18 22:12:45 +00:00
feat(docs): add flexibility for using docs menu with updates layout
This commit is contained in:
1 parent
ec8b60f71f
commit
db7a6f41ae
4 files changed
+25
-13
No files matched your search
@@ -1,24 +1,25 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="{{ site.LanguageCode | default "en-us" }}">
|
<html lang="{{ site.LanguageCode | default "en-us" }}">
|
||||||
|
|
||||||
{{ partial "site_head.html" . }}
|
{{ partial "site_head" . }}
|
||||||
<body id="top" data-spy="scroll" data-offset="70" data-target="{{ if or .IsHome (eq .Type "widget_page") }}#navbar-main{{else}}#TableOfContents{{end}}" {{ if not (.Scratch.Get "light") }}class="dark"{{end}}>
|
<body id="top" data-spy="scroll" data-offset="70" data-target="{{ if or .IsHome (eq .Type "widget_page") }}#navbar-main{{else}}#TableOfContents{{end}}" {{ if not (.Scratch.Get "light") }}class="dark"{{end}}>
|
||||||
|
|
||||||
{{ partial "search" . }}
|
{{ partial "search" . }}
|
||||||
|
|
||||||
{{ partial "navbar.html" . }}
|
{{ partial "navbar" . }}
|
||||||
|
|
||||||
{{ block "main" . }}{{ end }}
|
{{ block "main" . }}{{ end }}
|
||||||
|
|
||||||
{{ partial "site_js.html" . }}
|
{{ partial "site_js" . }}
|
||||||
|
|
||||||
{{ if ne .Type "docs" }}
|
{{/* Docs and Updates layouts include the site footer in a different location. */}}
|
||||||
|
{{ if not (in (slice "docs" "updates") .Type) }}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{{ partial "site_footer.html" . }}
|
{{ partial "site_footer" . }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ partial "citation.html" . }}
|
{{ partial "citation" . }}
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<div class="container-fluid docs">
|
<div class="container-fluid docs">
|
||||||
<div class="row flex-xl-nowrap">
|
<div class="row flex-xl-nowrap">
|
||||||
<div class="col-12 col-md-3 col-xl-2 docs-sidebar">
|
<div class="col-12 col-md-3 col-xl-2 docs-sidebar">
|
||||||
{{ partial "docs_sidebar.html" . }}
|
{{ partial "docs_sidebar" . }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ if .Params.toc }}
|
{{ if .Params.toc }}
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
{{ .TableOfContents }}
|
{{ .TableOfContents }}
|
||||||
|
|
||||||
{{ partial "docs_toc_foot.html" . }}
|
{{ partial "docs_toc_foot" . }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
{{ if site.Params.docs_section_pager }}
|
{{ if site.Params.docs_section_pager }}
|
||||||
<div class="article-widget">
|
<div class="article-widget">
|
||||||
{{ partial "section_pager.html" . }}
|
{{ partial "section_pager" . }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
{{ partial "site_footer.html" . }}
|
{{ partial "site_footer" . }}
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
{{ $current_page := . }}
|
{{ $current_page := . }}
|
||||||
|
|
||||||
{{/* Dynamically load menu for this docs page. */}}
|
{{/* Dynamically load menu for this docs page. */}}
|
||||||
{{ $menu_name := path.Base (path.Split .CurrentSection.File).Dir }}
|
{{/* Attempt to get menu name from `menu_name` param, Hugo's front matter menu config, or the last dir of filepath. */}}
|
||||||
|
{{ $menu_name := "" }}
|
||||||
|
{{ range $k, $v := .Params.menu }}
|
||||||
|
{{ $menu_name = $k }}
|
||||||
|
{{ end }}
|
||||||
|
{{ $menu_name = .Params.menu_name | default $menu_name | default (path.Base (path.Split .File).Dir) }}
|
||||||
{{ if not (index site.Menus $menu_name) }}
|
{{ if not (index site.Menus $menu_name) }}
|
||||||
{{ errorf "Please define menu items named `menu: %s:` in your %s front matter or define `[[menu.%s]]` in `config/default/menus.toml`. See https://sourcethemes.com/academic/docs/managing-content/#menus" $menu_name .Path $menu_name }}
|
{{ errorf "Please define menu items named `menu: %s:` in your %s front matter or define `[[menu.%s]]` in `config/default/menus.toml`. See https://sourcethemes.com/academic/docs/managing-content/#menus" $menu_name .Path $menu_name }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
@@ -18,7 +23,13 @@
|
|||||||
|
|
||||||
<nav class="collapse docs-links" id="docs-nav">
|
<nav class="collapse docs-links" id="docs-nav">
|
||||||
{{ with (index site.Menus $menu_name) }}
|
{{ with (index site.Menus $menu_name) }}
|
||||||
{{ range (index site.Menus $menu_name).ByWeight }}
|
|
||||||
|
{{/* Enable Updates layout to order by descending version name. */}}
|
||||||
|
{{ $menu := (index site.Menus $menu_name).ByWeight }}
|
||||||
|
{{ if eq ($.Scratch.Get "docs_menu_sort" | default "weight") "name_reverse" }}
|
||||||
|
{{ $menu = (index site.Menus $menu_name).ByName.Reverse }}
|
||||||
|
{{end}}
|
||||||
|
{{ range $menu }}
|
||||||
<div class="docs-toc-item{{ if $current_page.IsMenuCurrent $menu_name . }} active{{ end }}">
|
<div class="docs-toc-item{{ if $current_page.IsMenuCurrent $menu_name . }} active{{ end }}">
|
||||||
<a class="docs-toc-link" {{ if .URL }}href="{{ .URL }}"{{else if .HasChildren }}href="{{ (index .Children 0).URL }}"{{end}}>{{ .Name }}</a>
|
<a class="docs-toc-link" {{ if .URL }}href="{{ .URL }}"{{else if .HasChildren }}href="{{ (index .Children 0).URL }}"{{end}}>{{ .Name }}</a>
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<a href="https://sourcethemes.com/academic/" target="_blank" rel="noopener">Academic theme</a> for
|
<a href="https://sourcethemes.com/academic/" target="_blank" rel="noopener">Academic theme</a> for
|
||||||
<a href="https://gohugo.io" target="_blank" rel="noopener">Hugo</a>.
|
<a href="https://gohugo.io" target="_blank" rel="noopener">Hugo</a>.
|
||||||
|
|
||||||
{{ if ne .Type "docs" }}
|
{{ if not (in (slice "docs" "updates") .Type) }}
|
||||||
<span class="float-right" aria-hidden="true">
|
<span class="float-right" aria-hidden="true">
|
||||||
<a href="#" class="back-to-top">
|
<a href="#" class="back-to-top">
|
||||||
<span class="button_icon">
|
<span class="button_icon">
|
||||||
|
|||||||
Reference in new issue
Block a user