Add README.md
This commit is contained in:
parent
f4bcc2ecd9
commit
e62448627e
6 changed files with 127 additions and 35 deletions
85
README.md
Normal file
85
README.md
Normal file
|
@ -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)
|
|
@ -1,9 +1,8 @@
|
||||||
@import 'variables';
|
@import 'variables';
|
||||||
|
|
||||||
html, button, input, select, textarea, .pure-g [class *= "pure-u"] {
|
html, button, input, select, textarea, .pure-g [class *= "pure-u"] {
|
||||||
font-family: "Open Sans", "Roboto", sans-serif;
|
font-family: Roboto, sans-serif;
|
||||||
font-weight: 300;
|
font-weight: $body-font-weight;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.pure-g {
|
.pure-g {
|
||||||
|
@ -30,12 +29,11 @@ html, button, input, select, textarea, .pure-g [class *= "pure-u"] {
|
||||||
|
|
||||||
// font weight only for root sections
|
// font weight only for root sections
|
||||||
> li > .section {
|
> li > .section {
|
||||||
font-weight: 600;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.pure-menu-link, .pure-menu-heading {
|
.pure-menu-link, .pure-menu-heading {
|
||||||
color: $gray-800;
|
|
||||||
padding: $padding-4 $padding-16;
|
padding: $padding-4 $padding-16;
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
}
|
}
|
||||||
|
@ -44,12 +42,4 @@ html, button, input, select, textarea, .pure-g [class *= "pure-u"] {
|
||||||
&:hover, &.active {
|
&:hover, &.active {
|
||||||
background: none;
|
background: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: $gray-600;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.active {
|
|
||||||
color: $color-link;
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -9,8 +9,8 @@ $font-size-14: .875rem;
|
||||||
$font-size-16: 1rem;
|
$font-size-16: 1rem;
|
||||||
|
|
||||||
$size-48: 3rem;
|
$size-48: 3rem;
|
||||||
$size-56: 3.5rem;
|
// $size-56: 3.5rem;
|
||||||
$size-72: 4.5rem;
|
// $size-72: 4.5rem;
|
||||||
|
|
||||||
// Grayscale
|
// Grayscale
|
||||||
$white: #fff;
|
$white: #fff;
|
||||||
|
@ -28,9 +28,17 @@ $black: #000;
|
||||||
$color-link: #1177EE;
|
$color-link: #1177EE;
|
||||||
$color-visited-link: #7823c9;
|
$color-visited-link: #7823c9;
|
||||||
|
|
||||||
|
|
||||||
|
$body-background: none;
|
||||||
|
$body-font-color: $gray-800;
|
||||||
|
$body-font-weight: 300;
|
||||||
$body-line-height: 1.75;
|
$body-line-height: 1.75;
|
||||||
$body-min-width: 25rem;
|
$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-max-width: 64rem;
|
||||||
$content-min-width: $body-min-width;
|
$content-min-width: $body-min-width;
|
||||||
$nav-menu-width: 18rem;
|
|
||||||
$toc-menu-width: 14rem;
|
|
|
@ -13,7 +13,8 @@ html, body {
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
color: $gray-800;
|
color: $body-font-color;
|
||||||
|
background: $body-background;
|
||||||
line-height: $body-line-height;
|
line-height: $body-line-height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +25,12 @@ a {
|
||||||
|
|
||||||
.book-brand {
|
.book-brand {
|
||||||
padding: 0 $padding-16;
|
padding: 0 $padding-16;
|
||||||
font-weight: 300;
|
font-weight: 400;
|
||||||
|
|
||||||
|
a {
|
||||||
|
padding: 0 $padding-16;
|
||||||
|
color: $body-font-color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Navigation styles
|
// Navigation styles
|
||||||
|
@ -41,26 +47,26 @@ a {
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|
||||||
font-size: $font-size-14;
|
font-size: $font-size-14;
|
||||||
background: $gray-100;
|
background: $nav-background;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding-left: $padding-16;
|
padding-left: $padding-16;
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
a {
|
||||||
display: block;
|
display: block;
|
||||||
color: $gray-800;
|
color: $nav-link-color;
|
||||||
padding: $padding-4 $padding-16;
|
padding: $padding-4 $padding-16;
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
|
|
||||||
&[href]:hover {
|
&[href]:hover {
|
||||||
color: $gray-600;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
color: $color-link;
|
color: $color-link;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,5 +132,7 @@ a {
|
||||||
|
|
||||||
// Print styles
|
// Print styles
|
||||||
@media print {
|
@media print {
|
||||||
|
.book-nav, .book-toc {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
BIN
images/.DS_Store
vendored
BIN
images/.DS_Store
vendored
Binary file not shown.
|
@ -29,7 +29,8 @@
|
||||||
<div class="pure-u book-page markdown">
|
<div class="pure-u book-page markdown">
|
||||||
{{ block "main" . }} {{- .Content -}} {{ end }}
|
{{ block "main" . }} {{- .Content -}} {{ end }}
|
||||||
</div>
|
</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">
|
<div class="pure-u book-toc">
|
||||||
{{ partial "docs/toc" . }}
|
{{ partial "docs/toc" . }}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue