feat: add page parameter geekdocNav to disable navigation sidebar (#129)

This commit is contained in:
Robert Kaussow 2021-05-18 23:10:42 +02:00 committed by GitHub
parent 7938bc7d97
commit cd0cfe37ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 61 additions and 14 deletions

View File

@ -22,3 +22,5 @@ prebuilt
(S|s)ubdirector(ies|y) (S|s)ubdirector(ies|y)
(M|m)inify (M|m)inify
whitespace whitespace
relref
href

View File

@ -8,8 +8,10 @@
const results = document.querySelector('#gdoc-search-results'); const results = document.querySelector('#gdoc-search-results');
let showParent = {{ if .Site.Params.GeekdocSearchShowParent }}true{{ else }}false{{ end }} let showParent = {{ if .Site.Params.GeekdocSearchShowParent }}true{{ else }}false{{ end }}
input.addEventListener('focus', init); if (input) {
input.addEventListener('keyup', search); input.addEventListener('focus', init);
input.addEventListener('keyup', search);
}
function init() { function init() {
input.removeEventListener('focus', init); // init once input.removeEventListener('focus', init); // init once

View File

@ -1,6 +1,7 @@
--- ---
title: Documentation title: Documentation
description: Geekdoc is a simple Hugo theme for documentations. It is intentionally designed as a fast and lean theme and may not fit the requirements of complex projects. If a more feature-complete theme is required there are a lot of got alternatives out there. description: Geekdoc is a simple Hugo theme for documentations. It is intentionally designed as a fast and lean theme and may not fit the requirements of complex projects. If a more feature-complete theme is required there are a lot of got alternatives out there.
geekdocNav: false
--- ---
<!-- markdownlint-capture --> <!-- markdownlint-capture -->
@ -16,11 +17,46 @@ description: Geekdoc is a simple Hugo theme for documentations. It is intentiona
Geekdoc is a simple Hugo theme for documentations. It is intentionally designed as a fast and lean theme and may not fit the requirements of complex projects. If a more feature-complete theme is required there are a lot of got alternatives out there. Geekdoc is a simple Hugo theme for documentations. It is intentionally designed as a fast and lean theme and may not fit the requirements of complex projects. If a more feature-complete theme is required there are a lot of got alternatives out there.
{{< button relref="usage/getting-started/" >}}Explore Documentation{{< /button >}}
## Features ## Features
- Clean and simple design {{< columns >}}
- Light and mobile-friendly
- Easy customization ### Clean and simple design
- Zero initial configuration
- Handy shortcodes Stay focused on exploring the content and don't get overwhelmed by a complex design.
- Dark mode
<--->
### Light and mobile-friendly
The theme is powered by less than 1 MB and looks impressive on mobile devices as well as on a regular Desktop.
<--->
### Easy customization
The look and feel can be easily customized by CSS custom properties (variables), features can be adjusted by Hugo parameters.
{{< /columns >}}
{{< columns >}}
### Zero initial configuration
Getting started in minutes. The theme is shipped with a default configuration and works out of the box.
<--->
### Handy shortcodes
We included some (hopefully) useful custom shortcodes so you don't have to and can focus on writing amazing docs.
<--->
### Dark mode
Powerful dark mode that detects your system preferences or can be controlled by a toggle switch.
{{< /columns >}}

View File

@ -7,9 +7,5 @@ Buttons are styled links that can lead to local page or external link.
## Example ## Example
<!-- spellchecker-disable -->
{{< button relref="/" >}}Get Home{{< /button >}} {{< button relref="/" >}}Get Home{{< /button >}}
{{< button href="https://github.com/thegeeklab/hugo-geekdoc" >}}Contribute{{< /button >}} {{< button href="https://github.com/thegeeklab/hugo-geekdoc" >}}Contribute{{< /button >}}
<!-- spellchecker-enable -->

View File

@ -209,6 +209,10 @@ geekdocToC = 3
# Set a description for the current page. This will be shown in toc-trees objects. # Set a description for the current page. This will be shown in toc-trees objects.
geekdocDescription = geekdocDescription =
# Set false to hide the whole left navigation sidebar. Beware that it will make
# navigation pretty hard without adding some kind of on-page navigation.
geekdocNav = true
# Show a breadcrumb navigation bar at the top of each docs page. # Show a breadcrumb navigation bar at the top of each docs page.
geekdocBreadcrumb = false geekdocBreadcrumb = false
@ -262,6 +266,10 @@ geekdocToC: 3
# Set a description for the current page. This will be shown in toc-trees objects. # Set a description for the current page. This will be shown in toc-trees objects.
geekdocDescription: geekdocDescription:
# Set false to hide the whole left navigation sidebar. Beware that it will make
# navigation pretty hard without adding some kind of on-page navigation.
geekdocNav: true
# Show a breadcrumb navigation bar at the top of each docs page. # Show a breadcrumb navigation bar at the top of each docs page.
geekdocBreadcrumb: false geekdocBreadcrumb: false

View File

@ -12,14 +12,17 @@
<body itemscope itemtype="https://schema.org/WebPage"> <body itemscope itemtype="https://schema.org/WebPage">
{{ partial "svg-icon-symbols" . }} {{ partial "svg-icon-symbols" . }}
<div class="wrapper {{ if default false .Site.Params.geekdocDarkModeDim }}dark-mode-dim{{ end }}"> <div class="wrapper {{ if default false .Site.Params.GeekdocDarkModeDim }}dark-mode-dim{{ end }}">
<input type="checkbox" class="hidden" id="menu-control" /> <input type="checkbox" class="hidden" id="menu-control" />
{{ partial "site-header" (dict "Root" . "MenuEnabled" true) }} {{ $navEnabled := default true .Page.Params.GeekdocNav }}
{{ partial "site-header" (dict "Root" . "MenuEnabled" $navEnabled) }}
<main class="container flex flex-even"> <main class="container flex flex-even">
{{ if $navEnabled }}
<aside class="gdoc-nav"> <aside class="gdoc-nav">
{{ partial "menu" . }} {{ partial "menu" . }}
</aside> </aside>
{{ end }}
<div class="gdoc-page"> <div class="gdoc-page">
{{ template "main" . }} {{ template "main" . }}