diff options
-rw-r--r-- | README.md | 85 | ||||
-rw-r--r-- | assets/_pure-extension.scss | 16 | ||||
-rw-r--r-- | assets/_variables.scss | 16 | ||||
-rw-r--r-- | assets/styles.scss | 42 | ||||
-rw-r--r-- | images/.DS_Store | bin | 6148 -> 0 bytes | |||
-rw-r--r-- | layouts/docs/baseof.html | 3 |
6 files changed, 127 insertions, 35 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..0e570ea --- /dev/null +++ b/README.md @@ -0,0 +1,85 @@ +# Hugo Book Theme +### Documentation theme as simple as plain book + +Description, motivation + +![Screenshot](images/screenshot.png) + +## Features +* Clean simple design +* Mobile friendly +* Customizable menu +* Renders single site section (`docs` by default) + +## Installation +``` +git clone ... +``` + +## Configuration +### Menu +There are two options to render menu: +1. Use file tree as menu (Option by default). + You can set `title` and `weight` in front matter to adjust menu. + +2. Use leaf bundle and content of it's `index.md` as +menu. + You can enable it by pointing to leaf bundle with `BookMenuBundle` parameter on Site level. + + ```md + - [**Introduction**](/docs/introduction/) + - [Motivation](/docs/motivation/) + - [Configuration](/docs/configuration/) + - [Server](/docs/configuration/server/) + - [Client](/docs/configuration/client/) + <br /> + - [Addtional Information](docs/configuration/additional-information/) + - [*Links*](/docs/links/) + ``` + + Also see [Example](exampleSite/content/menu) and [Site configuration](#site-configuration) + + +### Site configuration +There is few configuration options you can add to your `config.yml|json|toml` file +```yaml +# (Optional) Set this to true if you use captial letters in file names +disablePathToLower: true + +params: + # (Optional, default true) Show or hide table of contents globally + # You can also specify this parameter per page in front matter + BookShowToC: true + + # (Optional, default none) Set leaf bundle to render side menu + # When not specified file structure and weights will be used + # See https://gohugo.io/content-management/page-bundles/ + BookMenuBundle: /docs/menu + + # (Optional, default docs) Specify section of content to render as menu + # You can also set value to "*" to render all sections to menu + BookSection: docs +``` + + +### Per document configuration +You can specify additional params per document in front matter +```yaml +--- +# Set type to 'docs' if you want to render page outside of configured section +type: docs + +# Set page weight to re-arrange items in file-tree menu (if BookMenuBundle not set) +weight: 10 + +# Set to mark page as top level section in file-tree menu (if BookMenuBundle not set) +bookTopSection: true + +# Set to hide table of contents, default true +bookShowToC: false +--- +``` + + +## License +[MIT](LICENSE)
\ No newline at end of file diff --git a/assets/_pure-extension.scss b/assets/_pure-extension.scss index e540ef2..853810a 100644 --- a/assets/_pure-extension.scss +++ b/assets/_pure-extension.scss @@ -1,9 +1,8 @@ @import 'variables'; html, button, input, select, textarea, .pure-g [class *= "pure-u"] { - font-family: "Open Sans", "Roboto", sans-serif; - font-weight: 300; - + font-family: Roboto, sans-serif; + font-weight: $body-font-weight; } .pure-g { @@ -30,12 +29,11 @@ html, button, input, select, textarea, .pure-g [class *= "pure-u"] { // font weight only for root sections > li > .section { - font-weight: 600; + font-weight: 700; } } .pure-menu-link, .pure-menu-heading { - color: $gray-800; padding: $padding-4 $padding-16; text-transform: capitalize; } @@ -44,12 +42,4 @@ html, button, input, select, textarea, .pure-g [class *= "pure-u"] { &:hover, &.active { background: none; } - - &:hover { - color: $gray-600; - } - - &.active { - color: $color-link; - } }
\ No newline at end of file diff --git a/assets/_variables.scss b/assets/_variables.scss index 125a29f..76d1ea7 100644 --- a/assets/_variables.scss +++ b/assets/_variables.scss @@ -9,8 +9,8 @@ $font-size-14: .875rem; $font-size-16: 1rem; $size-48: 3rem; -$size-56: 3.5rem; -$size-72: 4.5rem; +// $size-56: 3.5rem; +// $size-72: 4.5rem; // Grayscale $white: #fff; @@ -28,9 +28,17 @@ $black: #000; $color-link: #1177EE; $color-visited-link: #7823c9; + +$body-background: none; +$body-font-color: $gray-800; +$body-font-weight: 300; $body-line-height: 1.75; $body-min-width: 25rem; + +$nav-background: $gray-100; +$nav-link-color: $gray-800; +$nav-menu-width: 18rem; +$toc-menu-width: 14rem; + $content-max-width: 64rem; $content-min-width: $body-min-width; -$nav-menu-width: 18rem; -$toc-menu-width: 14rem;
\ No newline at end of file diff --git a/assets/styles.scss b/assets/styles.scss index 5d44a1d..d53fd23 100644 --- a/assets/styles.scss +++ b/assets/styles.scss @@ -13,7 +13,8 @@ html, body { } body { - color: $gray-800; + color: $body-font-color; + background: $body-background; line-height: $body-line-height; } @@ -24,7 +25,12 @@ a { .book-brand { padding: 0 $padding-16; - font-weight: 300; + font-weight: 400; + + a { + padding: 0 $padding-16; + color: $body-font-color; + } } // Navigation styles @@ -41,26 +47,26 @@ a { overflow-y: auto; font-size: $font-size-14; - background: $gray-100; + background: $nav-background; } ul { list-style: none; padding-left: $padding-16; - } - a { - display: block; - color: $gray-800; - padding: $padding-4 $padding-16; - text-transform: capitalize; - - &[href]:hover { - color: $gray-600; - } - - &.active { - color: $color-link; + a { + display: block; + color: $nav-link-color; + padding: $padding-4 $padding-16; + text-transform: capitalize; + + &[href]:hover { + opacity: 0.5; + } + + &.active { + color: $color-link; + } } } @@ -126,5 +132,7 @@ a { // Print styles @media print { - + .book-nav, .book-toc { + display: none; + } }
\ No newline at end of file diff --git a/images/.DS_Store b/images/.DS_Store Binary files differdeleted file mode 100644 index 5008ddf..0000000 --- a/images/.DS_Store +++ /dev/null diff --git a/layouts/docs/baseof.html b/layouts/docs/baseof.html index f7e8477..a71bd59 100644 --- a/layouts/docs/baseof.html +++ b/layouts/docs/baseof.html @@ -29,7 +29,8 @@ <div class="pure-u book-page markdown"> {{ block "main" . }} {{- .Content -}} {{ end }} </div> - {{ if and (default true .Site.Params.BookShowTOC) (.Page.TableOfContents) }} + {{ $showToC := default (default true .Site.Params.BookShowToC) .Params.bookshowtoc }} + {{ if and ($showToC) (.Page.TableOfContents) }} <div class="pure-u book-toc"> {{ partial "docs/toc" . }} </div> |