Merge pull request #637 from h-enk/new-docs-tree

Adds new docs tree — with a single command 🤖
This commit is contained in:
Henk Verlinde 2022-01-28 16:21:57 +01:00 committed by GitHub
commit b911313138
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 72 additions and 25 deletions

View File

@ -9,5 +9,3 @@ weight: 50
images: ["{{ .Name | urlize }}.jpg"] images: ["{{ .Name | urlize }}.jpg"]
contributors: [] contributors: []
--- ---
{{< img src="{{ .Name | urlize }}.jpg" alt="{{ replace .Name "-" " " | title }}" caption="{{ replace .Name "-" " " | title }}" class="wide" >}}

View File

@ -12,5 +12,3 @@ menu:
weight: 999 weight: 999
toc: true toc: true
--- ---
{{< img src="{{ .Name | urlize }}.jpg" alt="{{ replace .Name "-" " " | title }}" caption="{{ replace .Name "-" " " | title }}" >}}

View File

@ -1,8 +1,10 @@
--- ---
title: "Tutorial" title: "Docs"
description: "" description: ""
lead: ""
date: 2022-01-25T14:40:56+01:00 date: 2022-01-25T14:40:56+01:00
lastmod: 2022-01-25T14:40:56+01:00 lastmod: 2022-01-25T14:40:56+01:00
draft: false draft: false
images: [] images: []
type: docs
--- ---

View File

@ -1,8 +1,10 @@
--- ---
title: "Lorem" title: "Lorem"
description: "" description: ""
lead: ""
date: 2022-01-25T14:41:21+01:00 date: 2022-01-25T14:41:21+01:00
lastmod: 2022-01-25T14:41:21+01:00 lastmod: 2022-01-25T14:41:21+01:00
draft: false draft: false
images: [] images: []
type: docs
--- ---

View File

@ -1,8 +1,15 @@
--- ---
title: "Ipsum" title: "Ipsum"
description: "" description: ""
lead: ""
date: 2022-01-25T14:41:39+01:00 date: 2022-01-25T14:41:39+01:00
lastmod: 2022-01-25T14:41:39+01:00 lastmod: 2022-01-25T14:41:39+01:00
draft: false draft: false
images: [] images: []
type: docs
menu:
{{ .Section }}:
parent: "lorem"
weight: 100
toc: true
--- ---

View File

@ -10,11 +10,23 @@
identifier = "help" identifier = "help"
url = "/docs/help/" url = "/docs/help/"
[[docs]] # [[docs]]
# name = "Lorem"
# weight = 70
# identifier = "lorem"
# url = "/docs/lorem/"
[[guide]]
name = "Lorem" name = "Lorem"
weight = 70 weight = 10
identifier = "lorem" identifier = "lorem"
url = "/docs/lorem/" url = "/guide/lorem/"
[[tutorial]]
name = "Lorem"
weight = 10
identifier = "lorem"
url = "/tutorial/lorem/"
[[main]] [[main]]
name = "Docs" name = "Docs"
@ -22,6 +34,11 @@
# url = "/docs/1.0/prologue/introduction/" # url = "/docs/1.0/prologue/introduction/"
weight = 10 weight = 10
# [[main]]
# name = "Tutorial"
# url = "/tutorial/lorem/ipsum/"
# weight = 15
[[main]] [[main]]
name = "Blog" name = "Blog"
url = "/blog/" url = "/blog/"

View File

@ -92,4 +92,3 @@ lastMod = false
[menu.section] [menu.section]
auto = true auto = true
collapsibleSidebar = true collapsibleSidebar = true
mainSections = ["docs"]

View File

@ -2,7 +2,7 @@
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-md-12 col-lg-10 col-xl-8"> <div class="col-md-12 col-lg-10 col-xl-8">
<article> <article>
<h1 class="text-center">{{ .Title }}</h1> <h1 class="text-center">{{ if eq .CurrentSection .FirstSection }}{{ .Section | humanize }}{{ else }}{{ .Title }}{{ end }}</h1>
<div class="text-center">{{ .Content }}</div> <div class="text-center">{{ .Content }}</div>
<div class="card-list"> <div class="card-list">
{{ $currentSection := .CurrentSection }} {{ $currentSection := .CurrentSection }}

View File

@ -28,11 +28,12 @@
<h3 class="h6 text-uppercase mb-3 d-md-none">Main</h3> <h3 class="h6 text-uppercase mb-3 d-md-none">Main</h3>
<ul class="nav flex-column flex-md-row ms-md-n3"> <ul class="nav flex-column flex-md-row ms-md-n3">
{{- $current := . -}} {{- $current := . -}}
{{- $section := $current.Section -}}
{{ range .Site.Menus.main -}} {{ range .Site.Menus.main -}}
{{- $active := or ($current.IsMenuCurrent "main" .) ($current.HasMenuCurrent "main" .) -}} {{- $active := or ($current.IsMenuCurrent "main" .) ($current.HasMenuCurrent "main" .) -}}
{{- $active = or $active (eq .Name $current.Title) -}} {{- $active = or $active (eq .Name $current.Title) -}}
{{- $active = or $active (and (eq .Name "Docs") (eq $current.Section "docs")) -}} {{- $active = or $active (and (eq .Name ($section | humanize)) (eq $current.Section $section)) -}}
{{- $active = or $active (and (eq .Name "Blog") (eq $current.Section "blog" "authors")) -}} {{- $active = or $active (and (eq .Name "Blog") (eq $current.Section "blog" "contributors")) -}}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link ps-0 py-1{{ if $active }} active{{ end }}" href="{{ .URL | relLangURL }}">{{ .Name }}</a> <a class="nav-link ps-0 py-1{{ if $active }} active{{ end }}" href="{{ .URL | relLangURL }}">{{ .Name }}</a>
</li> </li>
@ -128,6 +129,25 @@
</div> </div>
</nav> </nav>
<div class="container-{{ if .Site.Params.options.fullWidth }}fluid{{ else }}xxl{{ end }}">
<aside class="doks-sidebar">
<nav id="doks-docs-nav" class="collapse d-lg-none" aria-label="Tertiary navigation">
{{ partial "sidebar/docs-menu.html" . }}
</nav>
</aside>
</div>
{{ else -}}
<nav class="doks-subnavbar py-2 sticky-lg-top d-lg-none" aria-label="Secondary navigation">
<div class="container-{{ if .Site.Params.options.fullWidth }}fluid{{ else }}xxl{{ end }} d-flex align-items-md-center">
<span class="navbar-text ms-0">{{ .Section | humanize }}</span>
<button class="btn doks-sidebar-toggle d-lg-none ms-auto order-3 collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#doks-docs-nav" aria-controls="doks-docs-nav" aria-expanded="false" aria-label="Toggle documentation navigation">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="doks doks-expand" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><title>Expand</title><polyline points="7 13 12 18 17 13"></polyline><polyline points="7 6 12 11 17 6"></polyline></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="doks doks-collapse" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><title>Collapse</title><polyline points="17 11 12 6 7 11"></polyline><polyline points="17 18 12 13 7 18"></polyline></svg>
</button>
</div>
</nav>
<div class="container-{{ if .Site.Params.options.fullWidth }}fluid{{ else }}xxl{{ end }}"> <div class="container-{{ if .Site.Params.options.fullWidth }}fluid{{ else }}xxl{{ end }}">
<aside class="doks-sidebar"> <aside class="doks-sidebar">
<nav id="doks-docs-nav" class="collapse d-lg-none" aria-label="Tertiary navigation"> <nav id="doks-docs-nav" class="collapse d-lg-none" aria-label="Tertiary navigation">

View File

@ -1,4 +1,4 @@
{{ with .Parent -}} {{ with .Parent -}}
{{ partial "main/breadcrumb.html" . -}} {{ partial "main/breadcrumb.html" . -}}
<li class="breadcrumb-item"><a href="{{ .RelPermalink }}">{{ if .IsHome }}Home{{ else }}{{ .Title }}{{ end }}</a></li> <li class="breadcrumb-item"><a href="{{ .RelPermalink }}">{{ if .IsHome }}Home{{ else if eq .CurrentSection .FirstSection }}{{ .Section | humanize }}{{ else }}{{ .Title }}{{ end }}</a></li>
{{ end -}} {{ end -}}

View File

@ -1,7 +1,8 @@
<!-- Auto collapsible section menu --> <!-- Auto collapsible section menu -->
<ul class="list-unstyled collapsible-sidebar"> <ul class="list-unstyled collapsible-sidebar">
{{ $currentPage := . -}} {{ $currentPage := . -}}
{{ range (where .Site.Sections "Section" "in" site.Params.menu.section.mainSections) }} {{ $section := $currentPage.Section -}}
{{ range (where .Site.Sections "Section" "in" $section) }}
{{ range .Sections.Reverse }} {{ range .Sections.Reverse }}
{{ $active := in $currentPage.RelPermalink .RelPermalink }} {{ $active := in $currentPage.RelPermalink .RelPermalink }}
<li class="mb-1"> <li class="mb-1">

View File

@ -1,6 +1,7 @@
<!-- Auto default section menu --> <!-- Auto default section menu -->
{{ $currentPage := . -}} {{ $currentPage := . -}}
{{ range (where .Site.Sections "Section" "in" site.Params.menu.section.mainSections) }} {{ $section := $currentPage.Section -}}
{{ range (where .Site.Sections "Section" "in" $section) }}
{{ range .Sections.Reverse }} {{ range .Sections.Reverse }}
{{ $active := in $currentPage.RelPermalink .RelPermalink }} {{ $active := in $currentPage.RelPermalink .RelPermalink }}
<h3 class="h6 text-uppercase mb-2">{{ .Title }}</h3> <h3 class="h6 text-uppercase mb-2">{{ .Title }}</h3>

View File

@ -1,8 +1,9 @@
<!-- Manual collapsible section menu --> <!-- Manual collapsible section menu -->
<ul class="list-unstyled collapsible-sidebar"> <ul class="list-unstyled collapsible-sidebar">
{{ $currentPage := . -}} {{ $currentPage := . -}}
{{ range $index, $element := .Site.Menus.docs -}} {{ $section := $currentPage.Section -}}
{{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} {{ range (index .Site.Menus $section) -}}
{{- $active := or ($currentPage.IsMenuCurrent $section .) ($currentPage.HasMenuCurrent $section .) -}}
{{- $active = or $active (eq $currentPage.Section .Identifier) -}} {{- $active = or $active (eq $currentPage.Section .Identifier) -}}
<li class="mb-1"> <li class="mb-1">
<button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#section-{{ .Identifier }}" aria-expanded="{{ if $active }}true{{ else }}false{{ end }}"> <button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#section-{{ .Identifier }}" aria-expanded="{{ if $active }}true{{ else }}false{{ end }}">
@ -30,7 +31,7 @@
<div class="collapse{{ if $active }} show{{ end }}" id="section-{{ .Identifier }}"> <div class="collapse{{ if $active }} show{{ end }}" id="section-{{ .Identifier }}">
<ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small"> <ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small">
{{ range .Children -}} {{ range .Children -}}
{{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} {{- $active := or ($currentPage.IsMenuCurrent $section .) ($currentPage.HasMenuCurrent $section .) -}}
{{- $active = or $active (eq $currentPage.Section .Identifier) -}} {{- $active = or $active (eq $currentPage.Section .Identifier) -}}
<li><a class="docs-link rounded{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li> <li><a class="docs-link rounded{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li>
{{ end -}} {{ end -}}
@ -39,7 +40,7 @@
{{ end -}} {{ end -}}
</li> </li>
{{ else -}} {{ else -}}
{{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} {{- $active := or ($currentPage.IsMenuCurrent $section .) ($currentPage.HasMenuCurrent $section .) -}}
{{- $active = or $active (eq $currentPage.Section .Identifier) -}} {{- $active = or $active (eq $currentPage.Section .Identifier) -}}
<li><a class="docs-link rounded{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li> <li><a class="docs-link rounded{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li>
{{ end -}} {{ end -}}
@ -49,7 +50,7 @@
{{ end -}} {{ end -}}
</li> </li>
{{ else -}} {{ else -}}
{{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} {{- $active := or ($currentPage.IsMenuCurrent $section .) ($currentPage.HasMenuCurrent $section .) -}}
{{- $active = or $active (eq $currentPage.Section .Identifier) -}} {{- $active = or $active (eq $currentPage.Section .Identifier) -}}
<li><a class="docs-link rounded{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li> <li><a class="docs-link rounded{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li>
{{ end -}} {{ end -}}

View File

@ -1,6 +1,7 @@
<!-- Manual default section menu --> <!-- Manual default section menu -->
{{ $currentPage := . -}} {{ $currentPage := . -}}
{{ range .Site.Menus.docs -}} {{ $section := $currentPage.Section -}}
{{ range (index .Site.Menus $section) -}}
<h3 class="h6 text-uppercase mb-2">{{ .Name }}</h3> <h3 class="h6 text-uppercase mb-2">{{ .Name }}</h3>
{{ if .HasChildren -}} {{ if .HasChildren -}}
<ul class="list-unstyled"> <ul class="list-unstyled">
@ -15,14 +16,14 @@
{{ if .HasChildren -}} {{ if .HasChildren -}}
<ul class="list-unstyled ms-3"> <ul class="list-unstyled ms-3">
{{ range .Children -}} {{ range .Children -}}
{{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} {{- $active := or ($currentPage.IsMenuCurrent $section .) ($currentPage.HasMenuCurrent $section .) -}}
{{- $active = or $active (eq $currentPage.Section .Identifier) -}} {{- $active = or $active (eq $currentPage.Section .Identifier) -}}
<li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li> <li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li>
{{ end -}} {{ end -}}
</ul> </ul>
{{ end -}} {{ end -}}
{{ else -}} {{ else -}}
{{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} {{- $active := or ($currentPage.IsMenuCurrent $section .) ($currentPage.HasMenuCurrent $section .) -}}
{{- $active = or $active (eq $currentPage.Section .Identifier) -}} {{- $active = or $active (eq $currentPage.Section .Identifier) -}}
<li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li> <li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li>
{{ end -}} {{ end -}}
@ -30,7 +31,7 @@
</ul> </ul>
{{ end -}} {{ end -}}
{{ else -}} {{ else -}}
{{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} {{- $active := or ($currentPage.IsMenuCurrent $section .) ($currentPage.HasMenuCurrent $section .) -}}
{{- $active = or $active (eq $currentPage.Section .Identifier) -}} {{- $active = or $active (eq $currentPage.Section .Identifier) -}}
<li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li> <li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li>
{{ end -}} {{ end -}}