Big documentation rewrite, move docs to example site
This commit is contained in:
@@ -8,16 +8,6 @@
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
- [Features](#features)
|
|
||||||
- [Requirements](#requirements)
|
|
||||||
- [Installation](#installation)
|
|
||||||
- [Menu](#menu)
|
|
||||||
- [Blog](#blog)
|
|
||||||
- [Configuration](#configuration)
|
|
||||||
- [Shortcodes](#shortcodes)
|
|
||||||
- [Versioning](#versioning)
|
|
||||||
- [Contributing](#contributing)
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Clean simple design
|
- Clean simple design
|
||||||
@@ -31,303 +21,29 @@
|
|||||||
- Primary features work without JavaScript
|
- Primary features work without JavaScript
|
||||||
- Dark Mode
|
- Dark Mode
|
||||||
|
|
||||||
## Requirements
|
## Quick Start
|
||||||
|
Use the [starter repository](https://github.com/alex-shpak/hugo-book-starter):
|
||||||
- Hugo 0.158 or higher
|
|
||||||
- Hugo extended version, [Installation Instructions](https://gohugo.io/installation/)
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
### Install as git submodule
|
|
||||||
Navigate to your hugo project root and run:
|
|
||||||
|
|
||||||
```
|
|
||||||
git submodule add https://github.com/alex-shpak/hugo-book themes/hugo-book
|
|
||||||
```
|
|
||||||
|
|
||||||
Then run hugo (or set `theme = "hugo-book"`/`theme: hugo-book` in configuration file)
|
|
||||||
|
|
||||||
```
|
|
||||||
hugo server --minify --theme hugo-book
|
|
||||||
```
|
|
||||||
|
|
||||||
### Install as hugo module
|
|
||||||
|
|
||||||
You can also add this theme as a Hugo module instead of a git submodule.
|
|
||||||
|
|
||||||
Start with initializing hugo modules, if not done yet:
|
|
||||||
```
|
|
||||||
hugo mod init github.com/repo/path
|
|
||||||
```
|
|
||||||
|
|
||||||
Navigate to your hugo project root and add [module] section to your `hugo.toml`:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
[module]
|
|
||||||
[[module.imports]]
|
|
||||||
path = 'github.com/alex-shpak/hugo-book'
|
|
||||||
```
|
|
||||||
|
|
||||||
Then, to load/update the theme module and run hugo:
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
hugo mod get -u
|
git clone https://github.com/alex-shpak/hugo-book-starter my-docs
|
||||||
|
cd my-docs
|
||||||
|
git submodule update --init --remote
|
||||||
hugo server --minify
|
hugo server --minify
|
||||||
```
|
```
|
||||||
|
|
||||||
### Creating site from scratch
|
## Requirements
|
||||||
|
- [Hugo](https://gohugo.io/installation/) extended edition, v0.158 or higher
|
||||||
|
|
||||||
Below is an example on how to create a new site from scratch:
|
## Documentation
|
||||||
|
Example site is self-documenting at [book.alxs.dev](https://book.alxs.dev)
|
||||||
```sh
|
|
||||||
hugo new site mydocs; cd mydocs
|
|
||||||
git init
|
|
||||||
git submodule add https://github.com/alex-shpak/hugo-book themes/hugo-book
|
|
||||||
cp -R themes/hugo-book/exampleSite/content.en/* ./content
|
|
||||||
```
|
|
||||||
|
|
||||||
```sh
|
|
||||||
hugo server --minify --theme hugo-book
|
|
||||||
```
|
|
||||||
|
|
||||||
## Menu
|
|
||||||
|
|
||||||
By default, the theme will render pages from the `content/docs` section as a menu in a tree structure.
|
|
||||||
You can set `title` and `weight` in the front matter of pages to adjust the order and titles in the menu, as well as other parameters to hide or alter urls in the menu. You can choose which folder to use for generating menu with `BookSection` configuration parameter.
|
|
||||||
|
|
||||||
## Blog
|
|
||||||
|
|
||||||
A simple blog is supported in the section `posts`.
|
|
||||||
A blog is not the primary usecase of this theme, so it has only minimal features.
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
### Site Configuration
|
|
||||||
|
|
||||||
There are a few configuration options that you can add to your `hugo.toml` file.
|
|
||||||
You can also see the `yaml` example [here](https://github.com/alex-shpak/hugo-book/blob/main/exampleSite/hugo.yaml).
|
|
||||||
|
|
||||||
```toml
|
|
||||||
# (Optional) Set Google Analytics if you use it to track your website.
|
|
||||||
# Always put it on the top of the configuration file, otherwise it won't work
|
|
||||||
googleAnalytics = "UA-XXXXXXXXX-X"
|
|
||||||
|
|
||||||
# (Optional) If you provide a Disqus shortname, comments will be enabled on
|
|
||||||
# all pages.
|
|
||||||
disqusShortname = "my-site"
|
|
||||||
|
|
||||||
# (Optional) Set this to true if you use capital letters in file names
|
|
||||||
disablePathToLower = true
|
|
||||||
|
|
||||||
# (Optional) Set this to true to enable 'Last Modified by' date and git author
|
|
||||||
# information on 'doc' type pages.
|
|
||||||
enableGitInfo = true
|
|
||||||
|
|
||||||
# (Optional) Theme is intended for documentation use, therefore it doesn't render taxonomy.
|
|
||||||
# You can remove related files with config below
|
|
||||||
disableKinds = ['taxonomy', 'taxonomyTerm']
|
|
||||||
|
|
||||||
# (Optional) Copyright information of the hugo book content
|
|
||||||
copyright = '[© CC BY 4.0](https://creativecommons.org/licenses/by/4.0/legalcode)'
|
|
||||||
|
|
||||||
[params]
|
|
||||||
# (Optional, default light) Sets color theme: light, dark or auto.
|
|
||||||
# Theme 'auto' switches between dark and light modes based on browser/os preferences. With plugins/themes added there are more themes.
|
|
||||||
BookTheme = 'light'
|
|
||||||
|
|
||||||
# (Optional, default true) Controls table of contents visibility on right side of pages.
|
|
||||||
# Start and end levels can be controlled with markup.tableOfContents setting.
|
|
||||||
# You can also specify this parameter per page in front matter.
|
|
||||||
BookToC = true
|
|
||||||
|
|
||||||
# (Optional, default none) Set the path to a logo for the book. If the logo is
|
|
||||||
# /static/logo.png then the path would be 'logo.png'
|
|
||||||
BookLogo = 'logo.png'
|
|
||||||
|
|
||||||
# (Optional, default 'favicon.png') Set the path to a favicon for the site.
|
|
||||||
# If the favicon is in /static/custom.svg, then the path would be 'custom.svg'.
|
|
||||||
BookFavicon = 'favicon.png'
|
|
||||||
|
|
||||||
# (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'
|
|
||||||
|
|
||||||
# (Optional, default none) Set template for commit link for the page. Requires enableGitInfo.
|
|
||||||
# When set enabled 'Last Modified' and a link to the commit in the footer of the page.
|
|
||||||
# Param is executed as template using .Site, .Page and .GitInfo as context.
|
|
||||||
BookLastChangeLink = 'https://github.com/alex-shpak/hugo-book/commit/{{ .GitInfo.Hash }}'
|
|
||||||
|
|
||||||
# (Optional, default none) Set template for edit page link.
|
|
||||||
# When set enabled 'Edit this page' link in the footer of the page.
|
|
||||||
# Param is executed as template using .Site, .Page and .Path as context.
|
|
||||||
BookEditLink = 'https://github.com/alex-shpak/hugo-book/edit/main/exampleSite/{{ .Path }}'
|
|
||||||
|
|
||||||
# (Optional, default 'January 2, 2006') Configure the date format used on the pages
|
|
||||||
# - In git information
|
|
||||||
# - In blog posts
|
|
||||||
# https://gohugo.io/functions/time/format/
|
|
||||||
BookDateFormat = 'January 2, 2006'
|
|
||||||
|
|
||||||
# (Optional, default true) Enables search function with flexsearch,
|
|
||||||
# Index is built on fly, therefore it might slowdown your website.
|
|
||||||
# Configuration for indexing can be adjusted in i18n folder per language.
|
|
||||||
BookSearch = true
|
|
||||||
|
|
||||||
# (Optional, default true) Enables comments template on pages
|
|
||||||
# By default partials/docs/comments.html includes Disqus template
|
|
||||||
# See https://gohugo.io/content-management/comments/#configure-disqus
|
|
||||||
# Can be overwritten by same param in page frontmatter
|
|
||||||
BookComments = true
|
|
||||||
|
|
||||||
# /!\ This is an experimental feature, might be removed or changed at any time
|
|
||||||
# (Optional, experimental, default false) Enables portable links and link checks in markdown pages.
|
|
||||||
# Portable links meant to work with text editors and let you write markdown without {{< relref >}} shortcode
|
|
||||||
# Theme will print warning if page referenced in markdown does not exists.
|
|
||||||
BookPortableLinks = true
|
|
||||||
|
|
||||||
# /!\ This is an experimental feature, might be removed or changed at any time
|
|
||||||
# (Optional, experimental, default false) Enables service worker that caches visited pages and resources for offline use.
|
|
||||||
BookServiceWorker = true
|
|
||||||
```
|
|
||||||
|
|
||||||
### Multi-Language Support
|
|
||||||
|
|
||||||
Theme supports Hugo's [multilingual mode](https://gohugo.io/content-management/multilingual/), just follow configuration guide there. You can also tweak search indexing configuration per language in `i18n` folder.
|
|
||||||
|
|
||||||
### Page Configuration
|
|
||||||
|
|
||||||
You can specify additional params in the front matter of individual pages:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
# Set type to 'docs' if you want to render page outside of configured section or if you render section other than 'docs'
|
|
||||||
type = 'docs'
|
|
||||||
|
|
||||||
# Set page weight to re-arrange items in file-tree menu.
|
|
||||||
weight = 10
|
|
||||||
|
|
||||||
# (Optional) Copyright information of the hugo page content
|
|
||||||
# Can be used to override the site-wide copyright notice
|
|
||||||
copyright = '[© CC BY 4.0](https://creativecommons.org/licenses/by/4.0/legalcode)'
|
|
||||||
|
|
||||||
# (Optional) Set to 'true' to mark page as flat section in file-tree menu.
|
|
||||||
bookFlatSection = false
|
|
||||||
|
|
||||||
# (Optional) Set to hide nested sections or pages at that level. Works only with file-tree menu mode
|
|
||||||
bookCollapseSection = true
|
|
||||||
|
|
||||||
# (Optional) Set true to hide page or section from side menu.
|
|
||||||
bookHidden = false
|
|
||||||
|
|
||||||
# (Optional) Set 'false' to hide ToC from page
|
|
||||||
bookToC = true
|
|
||||||
|
|
||||||
# (Optional) If you have enabled BookComments for the site, you can disable it for specific pages.
|
|
||||||
bookComments = true
|
|
||||||
|
|
||||||
# (Optional) Set to 'true' to exclude page from search index.
|
|
||||||
bookSearchExclude = false
|
|
||||||
|
|
||||||
# (Optional) Set explicit href attribute for this page in a menu.
|
|
||||||
bookHref = ''
|
|
||||||
|
|
||||||
# /!\ This is an experimental feature, might be removed or changed at any time
|
|
||||||
# (Optional) Set an icon for the menu entity of the page, icons are discovered from `assets/icons` folder.
|
|
||||||
bookIcon = 'calendar'
|
|
||||||
```
|
|
||||||
|
|
||||||
## Partials
|
|
||||||
|
|
||||||
There are layout partials available for you to easily override components of the theme in `layouts/partials/`.
|
|
||||||
|
|
||||||
In addition to this, there are several empty partials you can override to easily add/inject code.
|
|
||||||
|
|
||||||
| Empty Partial | Placement |
|
|
||||||
| -------------------------------------------------- | ------------------------------------------- |
|
|
||||||
| `layouts/partials/docs/inject/head.html` | Before closing `<head>` tag |
|
|
||||||
| `layouts/partials/docs/inject/body.html` | Before closing `<body>` tag |
|
|
||||||
| `layouts/partials/docs/inject/footer.html` | After page footer content |
|
|
||||||
| `layouts/partials/docs/inject/menu-before.html` | At the beginning of `<nav>` menu block |
|
|
||||||
| `layouts/partials/docs/inject/menu-after.html` | At the end of `<nav>` menu block |
|
|
||||||
| `layouts/partials/docs/inject/content-before.html` | Before page content |
|
|
||||||
| `layouts/partials/docs/inject/content-after.html` | After page content |
|
|
||||||
| `layouts/partials/docs/inject/toc-before.html` | At the beginning of table of contents block |
|
|
||||||
| `layouts/partials/docs/inject/toc-after.html` | At the end of table of contents block |
|
|
||||||
|
|
||||||
## Extra Customisation
|
|
||||||
|
|
||||||
| File | Description |
|
|
||||||
| ------------------------ | ------------------------------------------------------------------------------------- |
|
|
||||||
| `static/favicon.png` | Override default favicon |
|
|
||||||
| `assets/_custom.scss` | Customise or override scss styles |
|
|
||||||
| `assets/_variables.scss` | Override default SCSS variables |
|
|
||||||
| `assets/_fonts.scss` | Replace default font with custom fonts (e.g. local files or remote like google fonts) |
|
|
||||||
| `assets/mermaid.json` | Replace Mermaid initialization config |
|
|
||||||
| `assets/katex.json` | Replace KaTeX initialization config |
|
|
||||||
|
|
||||||
## Plugins
|
|
||||||
|
|
||||||
There are a few features implemented as pluggable `scss` styles. Usually these are features that don't make it to the core but can still be useful.
|
|
||||||
|
|
||||||
| Plugin | Description |
|
|
||||||
| --------------------------------- | ----------------------------------------------------------- |
|
|
||||||
| `assets/plugins/_numbered.scss` | Makes headings in markdown numbered, e.g. `1.1`, `1.2` |
|
|
||||||
| `assets/plugins/_scrollbars.scss` | Overrides scrollbar styles to look similar across platforms |
|
|
||||||
| `assets/plugins/_themes.scss` | Experimental: Extra color themes |
|
|
||||||
|
|
||||||
To enable plugins, add `@import "plugins/{name}";` to `assets/_custom.scss` in your website root.
|
|
||||||
|
|
||||||
## Hugo Internal Templates
|
|
||||||
|
|
||||||
There are a few hugo templates inserted in `<head>`
|
|
||||||
|
|
||||||
- [Google Analytics](https://gohugo.io/templates/embedded/#google-analytics)
|
|
||||||
- [Open Graph](https://gohugo.io/templates/embedded/#open-graph)
|
|
||||||
|
|
||||||
To disable Open Graph inclusion you can create your own empty file `/layouts/partials/opengraph.html`.
|
|
||||||
In fact almost empty not quite empty because an empty file looks like absent for HUGO. For example:
|
|
||||||
```
|
|
||||||
<!-- -->
|
|
||||||
```
|
|
||||||
|
|
||||||
## Special layouts
|
|
||||||
|
|
||||||
There are extra page layouts apart from documentation pages, to apply set `layout: {name}` in page frontmatter
|
|
||||||
|
|
||||||
| Layout | Description |
|
|
||||||
| --------------------------------- | ------------ |
|
|
||||||
| `landing` | Renders a langing/home page, hides side menus and adds home menu at the top |
|
|
||||||
| `book` | Renders a single-page with all pages in configured BookSection section |
|
|
||||||
|
|
||||||
## Shortcodes
|
|
||||||
|
|
||||||
- [Buttons](https://book.alxs.dev/docs/shortcodes/buttons/)
|
|
||||||
- [Columns](https://book.alxs.dev/docs/shortcodes/columns/)
|
|
||||||
- [Details](https://book.alxs.dev/docs/shortcodes/details/)
|
|
||||||
- [Hints](https://book.alxs.dev/docs/shortcodes/hints/)
|
|
||||||
- [KaTeX](https://book.alxs.dev/docs/shortcodes/katex/)
|
|
||||||
- [Mermaid](https://book.alxs.dev/docs/shortcodes/mermaid/)
|
|
||||||
- [Steps](https://book.alxs.dev/docs/shortcodes/steps/)
|
|
||||||
- [Tabs](https://book.alxs.dev/docs/shortcodes/tabs/)
|
|
||||||
|
|
||||||
By default, Goldmark trims unsafe outputs which might prevent some shortcodes from rendering. It is recommended to set `markup.goldmark.renderer.unsafe=true` if you encounter problems.
|
|
||||||
|
|
||||||
```toml
|
|
||||||
[markup.goldmark.renderer]
|
|
||||||
unsafe = true
|
|
||||||
```
|
|
||||||
|
|
||||||
If you are using `config.yaml` or `config.json`, consult the [configuration markup](https://gohugo.io/getting-started/configuration-markup/)
|
|
||||||
|
|
||||||
## Versioning
|
## Versioning
|
||||||
|
|
||||||
This theme follows a simple incremental versioning. e.g. `v1.0.0`, `v2.0.0` and so on. Releases will happen on breaking changes.
|
This theme follows a simple incremental versioning. e.g. `v1.0.0`, `v2.0.0` and so on. Releases will happen on breaking changes.
|
||||||
|
|
||||||
If you want lower maintenance, use one of the released versions. If you want to live on the bleeding edge of changes, you can use the `main` branch and update your website when needed, this also the default branch.
|
If you want lower maintenance, use one of the released versions. If you want to live on the bleeding edge of changes, you can use the `main` branch and update your website when needed, this also the default branch.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
### [Extra credits to contributors](https://github.com/alex-shpak/hugo-book/graphs/contributors)
|
### [Extra credits to contributors](https://github.com/alex-shpak/hugo-book/graphs/contributors)
|
||||||
|
|
||||||
Contributions are welcome and I will review and consider pull requests.
|
Contributions are welcome and I will review and consider pull requests.
|
||||||
Primary goals are:
|
Primary goals are:
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
title: "{{ .Name | humanize | title }}"
|
||||||
|
layout: book
|
||||||
|
# bookSearchExclude: false
|
||||||
|
---
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
title: "{{ .Name | humanize | title }}"
|
||||||
|
layout: landing
|
||||||
|
# bookSearchExclude: false
|
||||||
|
---
|
||||||
+4
-2
@@ -71,6 +71,10 @@ nav ul {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nav > ul {
|
||||||
|
margin-bottom: $padding-16;
|
||||||
|
}
|
||||||
|
|
||||||
ul.pagination {
|
ul.pagination {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -336,8 +340,6 @@ body[dir="rtl"] .book-menu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.book-languages {
|
.book-languages {
|
||||||
margin-bottom: $padding-16;
|
|
||||||
|
|
||||||
span {
|
span {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,12 +5,3 @@
|
|||||||
// @import "plugins/themes";
|
// @import "plugins/themes";
|
||||||
|
|
||||||
@import "plugins/themes";
|
@import "plugins/themes";
|
||||||
|
|
||||||
.book-hero {
|
|
||||||
min-height: $padding-16 * 24;
|
|
||||||
align-content: center;
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 3em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,50 +1,50 @@
|
|||||||
---
|
---
|
||||||
title: ""
|
|
||||||
layout: landing
|
layout: landing
|
||||||
---
|
---
|
||||||
|
|
||||||
<div class="book-hero">
|
<br />
|
||||||
|
|
||||||
# HUGO BOOK {anchor=false}
|
|
||||||
[Hugo](https://gohugo.io) documentation theme as simple as plain book
|
|
||||||
|
|
||||||
[{{< badge style="info" title="Hugo" value="0.158" >}}](https://github.com/gohugoio/hugo/releases/tag/v0.158.0)
|
|
||||||
[{{< badge style="default" title="License" value="MIT" >}}](https://github.com/alex-shpak/hugo-book/blob/main/LICENSE)
|
|
||||||
|
|
||||||
{{<button href="/docs/example">}}Explore{{</button>}}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
# Hugo Book {anchor=false}
|
||||||
{{% columns %}}
|
{{% columns %}}
|
||||||
- ## What Hugo-Book Theme Is
|
- Documentation theme for [Hugo](https://gohugo.io) as simple as plain book.
|
||||||
Hugo book theme is primarily designed to create technical documentation sites that are easy to read, write, navigate and maintain. It is an attempt to create a sustainable web project.
|
|
||||||
|
|
||||||
- ## What Hugo-Book Theme Is Not
|
Hugo-Book theme is designed to be easy to read, write, navigate and maintain.
|
||||||
Book theme is not trying to implement all features but to create a starting point. It is mostly feature complete and gets updated and improved to stay relevant with Hugo and modern web.
|
It is an attempt to create a sustainable web project.
|
||||||
|
|
||||||
|
{{<button href="/docs/introduction">}}Explore{{</button>}}
|
||||||
|
|
||||||
|
- ```shell
|
||||||
|
# TL;DR
|
||||||
|
git clone https://github.com/alex-shpak/hugo-book-starter documentation
|
||||||
|
cd documentation
|
||||||
|
git submodule update --init --remote
|
||||||
|
hugo server --minify
|
||||||
|
```
|
||||||
{{% /columns %}}
|
{{% /columns %}}
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
{{% columns %}}
|
{{% columns %}}
|
||||||
- {{< card >}}
|
- {{< card >}}
|
||||||
## Probably fast
|
### Probably fast {anchor=false}
|
||||||
Build on Hugo static site generator. "The world’s fastest framework for building websites".
|
Built on Hugo static site generator. "The world’s fastest framework for building websites".
|
||||||
{{< /card >}}
|
{{< /card >}}
|
||||||
|
|
||||||
- {{< card >}}
|
- {{< card >}}
|
||||||
## 50% JS free
|
### 50% JS free {anchor=false}
|
||||||
All important features are working even with JavaScript disabled in browser, including interactive shortcodes.
|
All important features are working even with JavaScript disabled in the browser, including interactive shortcodes.
|
||||||
{{< /card >}}
|
{{< /card >}}
|
||||||
|
|
||||||
- {{< card >}}
|
- {{< card >}}
|
||||||
## Minimalistic
|
### Minimalistic {anchor=false}
|
||||||
For real, it is very minimalistic, black on white. No extra tools are needed to build the site, only Hugo. No heavy JS or CSS frameworks included.
|
For real, it is very minimalistic, black on white. No extra tools are needed to build the site, only Hugo. No heavy JS or CSS frameworks included.
|
||||||
{{< /card >}}
|
{{< /card >}}
|
||||||
{{% /columns %}}
|
{{% /columns %}}
|
||||||
|
|
||||||
{{% columns %}}
|
{{% columns %}}
|
||||||
- {{< card >}}
|
- {{< card >}}
|
||||||
### Shortcodes
|
### Shortcodes {anchor=false}
|
||||||
Pretty good shortcodes are included to enhance markup files:
|
Pretty good shortcodes are included to enhance content:
|
||||||
[Columns](/docs/shortcodes/columns/),
|
[Columns](/docs/shortcodes/columns/),
|
||||||
[Cards](/docs/shortcodes/experimental/cards/),
|
[Cards](/docs/shortcodes/experimental/cards/),
|
||||||
[Tabs](/docs/shortcodes/tabs/),
|
[Tabs](/docs/shortcodes/tabs/),
|
||||||
@@ -55,12 +55,12 @@ layout: landing
|
|||||||
{{< /card >}}
|
{{< /card >}}
|
||||||
|
|
||||||
- {{< card >}}
|
- {{< card >}}
|
||||||
### Even more
|
### Even more {anchor=false}
|
||||||
Do people actually read these? I thought it was just a visual filler. But there is full-text search and multi-language support.
|
Do people actually read these? I thought it was just a visual filler. But there is full-text search and multi-language support.
|
||||||
{{< /card >}}
|
{{< /card >}}
|
||||||
|
|
||||||
- {{< card >}}
|
- {{< card >}}
|
||||||
### Made to be extendable
|
### Made to be extendable {anchor=false}
|
||||||
There are multiple points to inject own styles and templates to make your documentation your own.
|
There are multiple points to inject own styles and templates to make it your own.
|
||||||
{{< /card >}}
|
{{< /card >}}
|
||||||
{{% /columns %}}
|
{{% /columns %}}
|
||||||
|
|||||||
@@ -5,3 +5,34 @@ menu:
|
|||||||
after:
|
after:
|
||||||
weight: 7
|
weight: 7
|
||||||
---
|
---
|
||||||
|
|
||||||
|
# Single Page Layout
|
||||||
|
|
||||||
|
This page uses `layout: book`, which renders all content on a single page without sidebar navigation.
|
||||||
|
|
||||||
|
Use this layout for standalone pages that don't belong in the documentation hierarchy, such as:
|
||||||
|
|
||||||
|
- Changelog or release notes
|
||||||
|
- A comprehensive reference that should be scrollable as one document
|
||||||
|
- Print-friendly pages
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Set in frontmatter:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
layout: book
|
||||||
|
---
|
||||||
|
```
|
||||||
|
|
||||||
|
The page can still appear in menus via the `menu` frontmatter parameter:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
layout: book
|
||||||
|
menu:
|
||||||
|
after:
|
||||||
|
weight: 7
|
||||||
|
---
|
||||||
|
```
|
||||||
|
|||||||
@@ -0,0 +1,177 @@
|
|||||||
|
---
|
||||||
|
weight: 30
|
||||||
|
---
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
|
||||||
|
All theme parameters are set under `[params]` in your site config. Every parameter is optional.
|
||||||
|
|
||||||
|
## Theme Parameters
|
||||||
|
|
||||||
|
```toml {filename=hugo.toml}
|
||||||
|
[params]
|
||||||
|
# Color theme: 'light', 'dark' or 'auto'
|
||||||
|
# Auto switches based on OS/browser preference
|
||||||
|
BookTheme = 'light'
|
||||||
|
|
||||||
|
# Show table of contents on right side of pages
|
||||||
|
# Can also be set per-page via frontmatter
|
||||||
|
BookToC = true
|
||||||
|
|
||||||
|
# Path to favicon file relative to 'static' directory
|
||||||
|
BookFavicon = 'favicon.png'
|
||||||
|
|
||||||
|
# Path to logo image file relative to 'static' directory
|
||||||
|
BookLogo = 'logo.png'
|
||||||
|
|
||||||
|
# Root section to render as sidebar menu
|
||||||
|
# Default: 'docs'
|
||||||
|
BookSection = 'docs'
|
||||||
|
|
||||||
|
# Repository URL, used for edit and commit links
|
||||||
|
BookRepo = 'https://github.com/user/repo'
|
||||||
|
|
||||||
|
# Template for "Last Modified" commit link in page footer
|
||||||
|
# Requires enableGitInfo = true in site config
|
||||||
|
# Available context: .Site, .Page, .GitInfo
|
||||||
|
BookLastChangeLink = '{{ .Site.Params.BookRepo }}/commit/{{ .GitInfo.Hash }}'
|
||||||
|
|
||||||
|
# Template for "Edit this page" link in page footer
|
||||||
|
# Available context: .Site, .Page, .Path
|
||||||
|
BookEditLink = '{{ .Site.Params.BookRepo }}/edit/main/{{ .Path }}'
|
||||||
|
|
||||||
|
# Date format used in git info and blog posts
|
||||||
|
BookDateFormat = 'January 2, 2006'
|
||||||
|
|
||||||
|
# Enable full-text search with fuse.js
|
||||||
|
BookSearch = true
|
||||||
|
|
||||||
|
# Enable comments template on pages
|
||||||
|
# By default uses Disqus; override partials/docs/comments.html for others
|
||||||
|
BookComments = true
|
||||||
|
|
||||||
|
# Enable portable markdown links (resolve relative .md links)
|
||||||
|
# Values: false, 'warning', 'error'
|
||||||
|
BookPortableLinks = false
|
||||||
|
|
||||||
|
# Enable service worker for offline caching
|
||||||
|
# Values: false, true, 'precache'
|
||||||
|
BookServiceWorker = false
|
||||||
|
|
||||||
|
# Only show languages that have translations for current page
|
||||||
|
BookTranslatedOnly = false
|
||||||
|
```
|
||||||
|
|
||||||
|
## Search
|
||||||
|
|
||||||
|
Full-text search is enabled by default using [Fuse.js](https://www.fusejs.io/). The search index is built at page load from a generated JSON file.
|
||||||
|
|
||||||
|
```toml {filename=hugo.toml}
|
||||||
|
[params]
|
||||||
|
BookSearch = true
|
||||||
|
```
|
||||||
|
|
||||||
|
To exclude a page from the search index, set `bookSearchExclude: true` in its frontmatter.
|
||||||
|
|
||||||
|
If search is not working, verify that `baseURL` in your config matches the URL where the site is hosted. A mismatch prevents the search index from loading.
|
||||||
|
|
||||||
|
## Hugo Site Configuration
|
||||||
|
|
||||||
|
These Hugo settings are relevant for the theme
|
||||||
|
|
||||||
|
```toml {filename=hugo.toml}
|
||||||
|
# Preserve URL casing (recommended)
|
||||||
|
disablePathToLower = true
|
||||||
|
|
||||||
|
# Enable git metadata for "Last Modified" footer
|
||||||
|
enableGitInfo = true
|
||||||
|
```
|
||||||
|
|
||||||
|
## Markup
|
||||||
|
|
||||||
|
### Goldmark Renderer
|
||||||
|
|
||||||
|
The `unsafe` option is **required** for Mermaid and KaTeX shortcodes to render correctly
|
||||||
|
|
||||||
|
```toml {filename=hugo.toml}
|
||||||
|
[markup.goldmark.renderer]
|
||||||
|
unsafe = true
|
||||||
|
```
|
||||||
|
|
||||||
|
### Table of Contents
|
||||||
|
|
||||||
|
Control the heading levels included in the table of contents
|
||||||
|
|
||||||
|
```toml {filename=hugo.toml}
|
||||||
|
[markup.tableOfContents]
|
||||||
|
startLevel = 1
|
||||||
|
endLevel = 4
|
||||||
|
```
|
||||||
|
|
||||||
|
The `startLevel` and `endLevel` values apply globally. Individual pages can toggle the ToC on or off with the `bookToC` frontmatter parameter.
|
||||||
|
|
||||||
|
## Output Formats
|
||||||
|
|
||||||
|
The theme supports plain text output alongside HTML, useful for accessibility and LLMs
|
||||||
|
|
||||||
|
```toml {filename=hugo.toml}
|
||||||
|
[outputFormats.txt]
|
||||||
|
mediaType = 'text/plain'
|
||||||
|
baseName = 'source'
|
||||||
|
isPlainText = true
|
||||||
|
|
||||||
|
[outputs]
|
||||||
|
home = ['html', 'txt', 'rss']
|
||||||
|
page = ['html', 'txt']
|
||||||
|
section = ['html', 'txt']
|
||||||
|
```
|
||||||
|
|
||||||
|
## Portable Links
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> Experimental feature. May change or be removed.
|
||||||
|
|
||||||
|
Portable links resolve relative markdown links (`[text](./other-page.md)` or `[text](/docs/other-page.md)`) to the correct Hugo URLs. This lets you write standard markdown that works in both text editors and the rendered site.
|
||||||
|
|
||||||
|
```toml {filename=hugo.toml}
|
||||||
|
[params]
|
||||||
|
BookPortableLinks = 'warning'
|
||||||
|
```
|
||||||
|
|
||||||
|
`false`
|
||||||
|
: Disabled. Relative `.md` links are not resolved.
|
||||||
|
|
||||||
|
`'warning'`
|
||||||
|
: Enabled. Hugo prints a warning during build if a linked page doesn't exist.
|
||||||
|
|
||||||
|
`'error'`
|
||||||
|
: Enabled. Hugo fails the build if a linked page doesn't exist.
|
||||||
|
|
||||||
|
With portable links enabled, you can write
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
See [Configuration](./configuration.md) for details.
|
||||||
|
```
|
||||||
|
|
||||||
|
Instead of Hugo's `relref` shortcode. Both image links and page links are resolved.
|
||||||
|
|
||||||
|
## Service Worker
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> Experimental feature. May change or be removed.
|
||||||
|
|
||||||
|
Hugo Book can register a service worker for offline access to visited pages.
|
||||||
|
|
||||||
|
```toml {filename=hugo.toml}
|
||||||
|
[params]
|
||||||
|
BookServiceWorker = 'precache'
|
||||||
|
```
|
||||||
|
|
||||||
|
`false`
|
||||||
|
: Disabled (default).
|
||||||
|
|
||||||
|
`true`
|
||||||
|
: Enables a service worker that caches pages as you visit them for offline reading.
|
||||||
|
|
||||||
|
`'precache'`
|
||||||
|
: Enables a service worker that pre-populates the cache with all site pages on first load. Visited resources are also cached.
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
---
|
||||||
|
weight: 40
|
||||||
|
title: Content & Structure
|
||||||
|
bookCollapseSection: true
|
||||||
|
---
|
||||||
|
|
||||||
|
# Content Organization
|
||||||
|
|
||||||
|
Hugo Book renders pages from a section as a sidebar menu. By default this is the `docs/` directory.
|
||||||
|
|
||||||
|
## Example Directory Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
content/
|
||||||
|
├── docs/
|
||||||
|
│ ├── _index.md
|
||||||
|
│ ├── getting-started.md
|
||||||
|
│ ├── guide/
|
||||||
|
│ │ ├── _index.md
|
||||||
|
│ │ ├── install.md
|
||||||
|
│ │ └── configure.md
|
||||||
|
│ └── reference/
|
||||||
|
│ └── _index.md
|
||||||
|
├── posts/
|
||||||
|
│ ├── _index.md
|
||||||
|
│ └── my-post.md
|
||||||
|
└── _index.md
|
||||||
|
```
|
||||||
|
|
||||||
|
Pages are ordered by `weight` frontmatter, then alphabetically. Section `_index.md` files define the section entry in the menu.
|
||||||
|
|
||||||
|
## Changing the Menu Section
|
||||||
|
|
||||||
|
By default, pages under `docs/` are rendered as the sidebar menu. Change this with the `BookSection` parameter in [Configuration](/docs/configuration/). Set to `'/'` to render all top-level sections.
|
||||||
|
|
||||||
|
## Page Layouts
|
||||||
|
|
||||||
|
The theme provides several layouts:
|
||||||
|
|
||||||
|
| Layout | Usage | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| (default) | Documentation pages | Sidebar menu + content + optional ToC |
|
||||||
|
| `landing` | `layout: landing` | Full-width, no sidebar. Used for homepages. |
|
||||||
|
| `book` | `layout: book` | Single-page view with all subsections listed |
|
||||||
|
| `posts` | Pages under `posts/` | Blog-style with date, tags, pagination |
|
||||||
|
|
||||||
|
Set the layout in frontmatter
|
||||||
|
|
||||||
|
```yaml {filename=_index.md}
|
||||||
|
---
|
||||||
|
layout: landing
|
||||||
|
---
|
||||||
|
```
|
||||||
|
|
||||||
|
See [Pages](/docs/content/pages/) for frontmatter reference and [Menus](/docs/content/menus/) for navigation controls.
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
---
|
||||||
|
weight: 3
|
||||||
|
---
|
||||||
|
|
||||||
|
# Blog
|
||||||
|
|
||||||
|
Hugo Book includes templates for blog-style posts with dates, tags, and pagination. Blog functionality is very basic.
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
Create a `posts/` section in your content directory
|
||||||
|
|
||||||
|
```
|
||||||
|
content/
|
||||||
|
└── posts/
|
||||||
|
├── _index.md
|
||||||
|
└── my-first-post.md
|
||||||
|
```
|
||||||
|
|
||||||
|
Add the blog section to a menu so readers can find it
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
title: Blog
|
||||||
|
menu:
|
||||||
|
after:
|
||||||
|
weight: 5
|
||||||
|
---
|
||||||
|
```
|
||||||
|
|
||||||
|
## Post Frontmatter
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
title: "My First Post"
|
||||||
|
date: 2025-01-15
|
||||||
|
tags: ["hugo", "documentation"]
|
||||||
|
categories: ["Guides"]
|
||||||
|
---
|
||||||
|
```
|
||||||
|
|
||||||
|
## Thumbnails
|
||||||
|
|
||||||
|
Posts can display a thumbnail image. By default the theme looks for a file matching `thumbnail.*` in the post's page bundle. Override the pattern per-post
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
bookPostThumbnail: "cover.*"
|
||||||
|
---
|
||||||
|
```
|
||||||
|
|
||||||
|
## Date Format
|
||||||
|
|
||||||
|
The date display format is configured site-wide via `BookDateFormat`. See [Configuration](/docs/configuration/) for details.
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
---
|
||||||
|
weight: 2
|
||||||
|
---
|
||||||
|
|
||||||
|
# Menu System
|
||||||
|
|
||||||
|
Hugo Book supports two types of menus: an automatic file-tree menu built from your content structure, and Hugo's standard menu system for additional navigation.
|
||||||
|
|
||||||
|
## File-Tree Menu
|
||||||
|
|
||||||
|
The sidebar menu is automatically generated from pages in the `BookSection` directory (default: `docs/`). The hierarchy mirrors your directory structure.
|
||||||
|
|
||||||
|
Control how sections appear with [page frontmatter](/docs/content/pages/).
|
||||||
|
|
||||||
|
## Hugo Menus
|
||||||
|
|
||||||
|
The theme renders three Hugo menu locations:
|
||||||
|
|
||||||
|
| Menu | Location
|
||||||
|
| -- | --
|
||||||
|
| `menu.before` | Rendered **above** the file-tree menu.
|
||||||
|
| `menu.after` | Rendered **below** the file-tree menu.
|
||||||
|
| `menu.home` | Rendered on the landing page header (only on pages with `layout: landing`).
|
||||||
|
|
||||||
|
### Configuration
|
||||||
|
|
||||||
|
Define menus in your site config
|
||||||
|
|
||||||
|
```toml {filename=hugo.toml}
|
||||||
|
[[menu.before]]
|
||||||
|
name = 'Overview'
|
||||||
|
url = '/overview/'
|
||||||
|
weight = 1
|
||||||
|
|
||||||
|
[[menu.after]]
|
||||||
|
name = 'Github'
|
||||||
|
url = 'https://github.com/user/repo'
|
||||||
|
weight = 10
|
||||||
|
|
||||||
|
[[menu.after]]
|
||||||
|
name = 'Hugo Themes'
|
||||||
|
url = 'https://themes.gohugo.io/themes/hugo-book/'
|
||||||
|
weight = 20
|
||||||
|
```
|
||||||
|
|
||||||
|
Or add pages to menus via frontmatter
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
title: Blog
|
||||||
|
menu:
|
||||||
|
after:
|
||||||
|
weight: 5
|
||||||
|
---
|
||||||
|
```
|
||||||
|
|
||||||
|
### Menu Item Parameters
|
||||||
|
|
||||||
|
Menu items support these params under `[params]`:
|
||||||
|
|
||||||
|
```toml {filename=hugo.toml}
|
||||||
|
[[menu.after]]
|
||||||
|
name = 'Example'
|
||||||
|
url = '/example/'
|
||||||
|
weight = 10
|
||||||
|
[menu.after.params]
|
||||||
|
bookIcon = 'star' # Icon name to display next to the item
|
||||||
|
bookNewTab = true # Open the link in a new tab
|
||||||
|
class = 'custom-class' # CSS class to add to the menu item
|
||||||
|
```
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
---
|
||||||
|
title: Multi-Language
|
||||||
|
weight: 4
|
||||||
|
---
|
||||||
|
|
||||||
|
# Multi-Language Support
|
||||||
|
|
||||||
|
Hugo Book supports Hugo's [multilingual mode](https://gohugo.io/content-management/multilingual/) with content translation by directory.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Define languages in your site config
|
||||||
|
|
||||||
|
```toml {filename=hugo.toml}
|
||||||
|
[languages]
|
||||||
|
[languages.en]
|
||||||
|
label = 'English'
|
||||||
|
contentDir = 'content.en'
|
||||||
|
weight = 1
|
||||||
|
|
||||||
|
[languages.zh]
|
||||||
|
label = 'Chinese'
|
||||||
|
contentDir = 'content.zh'
|
||||||
|
weight = 2
|
||||||
|
|
||||||
|
[languages.he]
|
||||||
|
label = 'Hebrew'
|
||||||
|
contentDir = 'content.he'
|
||||||
|
direction = 'rtl'
|
||||||
|
weight = 3
|
||||||
|
```
|
||||||
|
|
||||||
|
A language selector dropdown appears automatically when multiple languages are configured.
|
||||||
|
|
||||||
|
## RTL Support
|
||||||
|
|
||||||
|
Set `direction = 'rtl'` on a language to enable right-to-left layout. The entire page layout, including the sidebar menu, mirrors automatically.
|
||||||
|
|
||||||
|
## Translation Dropdown
|
||||||
|
|
||||||
|
By default, all configured languages appear in the selector. To only show languages that have a translation for the current page
|
||||||
|
|
||||||
|
```toml {filename=hugo.toml}
|
||||||
|
[params]
|
||||||
|
BookTranslatedOnly = true
|
||||||
|
```
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
---
|
||||||
|
weight: 1
|
||||||
|
---
|
||||||
|
|
||||||
|
# Page Frontmatter
|
||||||
|
|
||||||
|
Every page can use these [frontmatter](https://gohugo.io/content-management/front-matter/) parameters to control its behavior in the theme.
|
||||||
|
|
||||||
|
{{< tabs >}}
|
||||||
|
{{% tab "YAML" %}}
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
title: My Page
|
||||||
|
weight: 10
|
||||||
|
bookToC: true
|
||||||
|
bookCollapseSection: true
|
||||||
|
---
|
||||||
|
```
|
||||||
|
{{% /tab %}}
|
||||||
|
|
||||||
|
{{% tab "TOML" %}}
|
||||||
|
```toml
|
||||||
|
+++
|
||||||
|
title = 'My Page'
|
||||||
|
weight = 10
|
||||||
|
bookToC = true
|
||||||
|
bookCollapseSection = true
|
||||||
|
+++
|
||||||
|
```
|
||||||
|
{{% /tab %}}
|
||||||
|
|
||||||
|
{{% tab "JSON" %}}
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"title": "My Page",
|
||||||
|
"weight": 10,
|
||||||
|
"bookToC": true,
|
||||||
|
"bookCollapseSection": true
|
||||||
|
}
|
||||||
|
```
|
||||||
|
{{% /tab %}}
|
||||||
|
{{< /tabs >}}
|
||||||
|
|
||||||
|
## Navigation
|
||||||
|
|
||||||
|
These parameters control how the page appears in the sidebar menu. Set in page frontmatter.
|
||||||
|
|
||||||
|
| Parameter | Default | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `weight` | | Menu ordering. Lower values appear first. Without weight, pages are sorted alphabetically. |
|
||||||
|
| `bookHidden` | `false` | Hide the page from the sidebar menu. The page is still accessible by URL. |
|
||||||
|
| `bookCollapseSection` | `false` | Make a section collapsible in the sidebar. Subsections are hidden until clicked. |
|
||||||
|
| `bookFlatSection` | `false` | Display subsection pages at the same level instead of nesting them. |
|
||||||
|
| `bookHref` | | Override the menu link with an external URL. |
|
||||||
|
| `bookIcon` | | Display an icon next to the menu entry. |
|
||||||
|
|
||||||
|
## Content Display
|
||||||
|
|
||||||
|
These parameters control page content rendering. Set in page frontmatter.
|
||||||
|
|
||||||
|
| Parameter | Default | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `bookToC` | | Show or hide the table of contents. Overrides the site-level `BookToC` setting. |
|
||||||
|
| `bookComments` | | Show or hide comments. Overrides the site-level `BookComments` setting. |
|
||||||
|
| `bookSearchExclude` | `false` | Exclude this page from the search index. |
|
||||||
|
|
||||||
|
See [Blog](/docs/content/blog/) for post-specific frontmatter.
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
---
|
||||||
|
weight: 50
|
||||||
|
---
|
||||||
|
|
||||||
|
# Customization
|
||||||
|
|
||||||
|
Hugo Book can be customized through theming, custom SCSS, 'inject' partials, and file overrides.
|
||||||
|
|
||||||
|
## Built-in Themes
|
||||||
|
|
||||||
|
Set `BookTheme` in your site config
|
||||||
|
|
||||||
|
```toml {filename=hugo.toml}
|
||||||
|
[params]
|
||||||
|
BookTheme = 'light' # or 'dark', 'auto'
|
||||||
|
```
|
||||||
|
|
||||||
|
| Theme | Description |
|
||||||
|
| --- | --- |
|
||||||
|
| `light` | Default. Light background with dark text. |
|
||||||
|
| `dark` | Dark background (Nord palette) with light text. |
|
||||||
|
| `auto` | Switches between light and dark based on OS/browser preference (`prefers-color-scheme`). |
|
||||||
|
|
||||||
|
## Plugin Themes
|
||||||
|
|
||||||
|
Additional themes are available as SCSS plugins. Import in your `assets/_custom.scss`
|
||||||
|
|
||||||
|
```scss
|
||||||
|
@import "plugins/themes";
|
||||||
|
```
|
||||||
|
|
||||||
|
Then set `BookTheme` to one of:
|
||||||
|
|
||||||
|
| Theme | Description |
|
||||||
|
| --- | --- |
|
||||||
|
| `contrast-light` | High contrast light variant |
|
||||||
|
| `contrast-dark` | High contrast dark variant |
|
||||||
|
| `contrast-auto` | High contrast, auto-switching |
|
||||||
|
| `catppuccin-light` | [Catppuccin](https://catppuccin.com/) Latte palette |
|
||||||
|
| `catppuccin-dark` | Catppuccin Frappe palette |
|
||||||
|
| `catppuccin-auto` | Catppuccin, auto-switching |
|
||||||
|
| `ayu-light` | [Ayu](https://github.com/ayu-theme) light palette |
|
||||||
|
| `ayu-dark` | Ayu mirage dark palette |
|
||||||
|
| `ayu-auto` | Ayu, auto-switching |
|
||||||
|
|
||||||
|
## Custom Theme
|
||||||
|
|
||||||
|
Define a theme mixin in `assets/_custom.scss`
|
||||||
|
|
||||||
|
```scss
|
||||||
|
@mixin theme-mytheme {
|
||||||
|
--body-background: #fafafa;
|
||||||
|
--body-font-color: #333;
|
||||||
|
--color-link: #0066cc;
|
||||||
|
--color-visited-link: #6633cc;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Then set `BookTheme = 'mytheme'`. The theme uses `@include theme-{{ .Site.Params.BookTheme }}` to select the mixin at build time.
|
||||||
|
|
||||||
|
For auto-switching themes (light/dark based on OS preference), see the `theme-auto` mixin in `assets/_defaults.scss` as a reference.
|
||||||
|
|
||||||
|
## CSS Custom Properties
|
||||||
|
|
||||||
|
Override CSS custom properties in `_custom.scss` to adjust the current theme. The full set of properties is defined in [`assets/_defaults.scss`](https://github.com/alex-shpak/hugo-book/blob/main/assets/_defaults.scss).
|
||||||
|
|
||||||
|
## Custom Styles
|
||||||
|
|
||||||
|
The theme includes an empty `assets/_custom.scss` file that is loaded after all theme styles. Create this file in your project's `assets/` directory to add custom CSS without overriding the entire stylesheet.
|
||||||
|
|
||||||
|
```scss
|
||||||
|
// assets/_custom.scss
|
||||||
|
|
||||||
|
.book-page {
|
||||||
|
max-width: 60rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.book-menu nav {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## SCSS Plugins
|
||||||
|
|
||||||
|
The theme ships with optional SCSS plugins. Import them in your `_custom.scss`:
|
||||||
|
|
||||||
|
```scss
|
||||||
|
@import "plugins/numbered"; /* Automatically number headings in the content area */
|
||||||
|
@import "plugins/scrollbars"; /* Style scrollbars in the sidebar and content area */
|
||||||
|
```
|
||||||
|
|
||||||
|
## SCSS Variables
|
||||||
|
|
||||||
|
Layout variables like sidebar width, breakpoints, and padding are defined in [`assets/_defaults.scss`](https://github.com/alex-shpak/hugo-book/blob/main/assets/_defaults.scss). Override them in your `_custom.scss`.
|
||||||
|
|
||||||
|
## 'Inject' Partials
|
||||||
|
|
||||||
|
The theme provides empty partial templates at key points in the page layout. Override these to inject custom HTML without modifying the base templates.
|
||||||
|
|
||||||
|
Create matching files in your project's `layouts/_partials/docs/inject/` directory.
|
||||||
|
|
||||||
|
| Partial | Location |
|
||||||
|
| --- | --- |
|
||||||
|
| `inject/head.html` | Inside `<head>`, e.g. meta tags, stylesheets, scripts |
|
||||||
|
| `inject/body.html` | Before `</body>`, e.g. analytics, chat widgets, scripts |
|
||||||
|
| `inject/menu-before.html` | Before the sidebar menu |
|
||||||
|
| `inject/menu-after.html` | After the sidebar menu |
|
||||||
|
| `inject/content-before.html` | Before the page content |
|
||||||
|
| `inject/content-after.html` | After the page content |
|
||||||
|
| `inject/toc-before.html` | Before the table of contents |
|
||||||
|
| `inject/toc-after.html` | After the table of contents |
|
||||||
|
| `inject/footer.html` | Inside the page footer |
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
To add a Google Analytics script, create `layouts/_partials/docs/inject/head.html`
|
||||||
|
|
||||||
|
```html
|
||||||
|
{{ with .Site.Params.googleAnalytics }}
|
||||||
|
<script async src="https://www.googletagmanager.com/gtag/js?id={{ . }}"></script>
|
||||||
|
{{ end }}
|
||||||
|
```
|
||||||
|
|
||||||
|
To add a custom banner above every page, create `layouts/_partials/docs/inject/content-before.html`
|
||||||
|
|
||||||
|
```html
|
||||||
|
<div class="my-banner">
|
||||||
|
This documentation is for version 2.0. See <a href="/v1/">version 1.0 docs</a>.
|
||||||
|
</div>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Override Priority
|
||||||
|
|
||||||
|
Hugo's [lookup order](https://gohugo.io/templates/lookup-order/) lets you override any theme file by creating the same file in your project:
|
||||||
|
|
||||||
|
- `layouts/`: Override templates and partials
|
||||||
|
- `assets/`: Override SCSS and JavaScript
|
||||||
|
- `static/`: Override static files (favicon, images)
|
||||||
|
- `i18n/`: Override or add translations
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
---
|
|
||||||
weight: 1
|
|
||||||
bookFlatSection: true
|
|
||||||
title: "Example Site"
|
|
||||||
---
|
|
||||||
|
|
||||||
# Introduction
|
|
||||||
|
|
||||||
## Ferre hinnitibus erat accipitrem dixi Troiae tollens
|
|
||||||
|
|
||||||
Lorem markdownum, a quoque nutu est *quodcumque mandasset* veluti. Passim
|
|
||||||
inportuna totidemque nympha fert; repetens pendent, poenarum guttura sed vacet
|
|
||||||
non, mortali undas. Omnis pharetramque gramen portentificisque membris servatum
|
|
||||||
novabis fallit de nubibus atque silvas mihi. **Dixit repetitaque Quid**; verrit
|
|
||||||
longa; sententia [mandat](http://pastor-ad.io/questussilvas) quascumque nescio
|
|
||||||
solebat [litore](http://lacrimas-ab.net/); noctes. *Hostem haerentem* circuit
|
|
||||||
[plenaque tamen](http://www.sine.io/in).
|
|
||||||
|
|
||||||
- Pedum ne indigenae finire invergens carpebat
|
|
||||||
- Velit posses summoque
|
|
||||||
- De fumos illa foret
|
|
||||||
|
|
||||||
## Est simul fameque tauri qua ad
|
|
||||||
|
|
||||||
Locum nullus nisi vomentes. Ab Persea sermone vela, miratur aratro; eandem
|
|
||||||
Argolicas gener.
|
|
||||||
|
|
||||||
## Me sol
|
|
||||||
|
|
||||||
Nec dis certa fuit socer, Nonacria **dies** manet tacitaque sibi? Sucis est
|
|
||||||
iactata Castrumque iudex, et iactato quoque terraeque es tandem et maternos
|
|
||||||
vittis. Lumina litus bene poenamque animos callem ne tuas in leones illam dea
|
|
||||||
cadunt genus, et pleno nunc in quod. Anumque crescentesque sanguinis
|
|
||||||
[progenies](http://www.late.net/alimentavirides) nuribus rustica tinguet. Pater
|
|
||||||
omnes liquido creditis noctem.
|
|
||||||
|
|
||||||
if (mirrored(icmp_dvd_pim, 3, smbMirroredHard) != lion(clickImportQueue,
|
|
||||||
viralItunesBalancing, bankruptcy_file_pptp)) {
|
|
||||||
file += ip_cybercrime_suffix;
|
|
||||||
}
|
|
||||||
if (runtimeSmartRom == netMarketingWord) {
|
|
||||||
virusBalancingWin *= scriptPromptBespoke + raster(post_drive,
|
|
||||||
windowsSli);
|
|
||||||
cd = address_hertz_trojan;
|
|
||||||
soap_ccd.pcbServerGigahertz(asp_hardware_isa, offlinePeopleware, nui);
|
|
||||||
} else {
|
|
||||||
megabyte.api = modem_flowchart - web + syntaxHalftoneAddress;
|
|
||||||
}
|
|
||||||
if (3 < mebibyteNetworkAnimated) {
|
|
||||||
pharming_regular_error *= jsp_ribbon + algorithm * recycleMediaKindle(
|
|
||||||
dvrSyntax, cdma);
|
|
||||||
adf_sla *= hoverCropDrive;
|
|
||||||
templateNtfs = -1 - vertical;
|
|
||||||
} else {
|
|
||||||
expressionCompressionVariable.bootMulti = white_eup_javascript(
|
|
||||||
table_suffix);
|
|
||||||
guidPpiPram.tracerouteLinux += rtfTerabyteQuicktime(1,
|
|
||||||
managementRosetta(webcamActivex), 740874);
|
|
||||||
}
|
|
||||||
var virusTweetSsl = nullGigo;
|
|
||||||
|
|
||||||
## Trepident sitimque
|
|
||||||
|
|
||||||
Sentiet et ferali errorem fessam, coercet superbus, Ascaniumque in pennis
|
|
||||||
mediis; dolor? Vidit imi **Aeacon** perfida propositos adde, tua Somni Fluctibus
|
|
||||||
errante lustrat non.
|
|
||||||
|
|
||||||
Tamen inde, vos videt e flammis Scythica parantem rupisque pectora umbras. Haec
|
|
||||||
ficta canistris repercusso simul ego aris Dixit! Esse Fama trepidare hunc
|
|
||||||
crescendo vigor ululasse vertice *exspatiantur* celer tepidique petita aversata
|
|
||||||
oculis iussa est me ferro.
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
# 4th Level of Menu
|
|
||||||
|
|
||||||
## Caesorum illa tu sentit micat vestes papyriferi
|
|
||||||
|
|
||||||
Inde aderam facti; Theseus vis de tauri illa peream. Oculos **uberaque** non
|
|
||||||
regisque vobis cursuque, opus venit quam vulnera. Et maiora necemque, lege modo;
|
|
||||||
gestanda nitidi, vero? Dum ne pectoraque testantur.
|
|
||||||
|
|
||||||
Venasque repulsa Samos qui, exspectatum eram animosque hinc, [aut
|
|
||||||
manes](http://www.creveratnon.net/apricaaetheriis), Assyrii. Cupiens auctoribus
|
|
||||||
pariter rubet, profana magni super nocens. Vos ius sibilat inpar turba visae
|
|
||||||
iusto! Sedes ante dum superest **extrema**.
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
# 3rd Level of Menu
|
|
||||||
|
|
||||||
Nefas discordemque domino montes numen tum humili nexilibusque exit, Iove. Quae
|
|
||||||
miror esse, scelerisque Melaneus viribus. Miseri laurus. Hoc est proposita me
|
|
||||||
ante aliquid, aura inponere candidioribus quidque accendit bella, sumpta.
|
|
||||||
Intravit quam erat figentem hunc, motus de fontes parvo tempestate.
|
|
||||||
|
|
||||||
iscsi_virus = pitch(json_in_on(eupViral),
|
|
||||||
northbridge_services_troubleshooting, personal(
|
|
||||||
firmware_rw.trash_rw_crm.device(interactive_gopher_personal,
|
|
||||||
software, -1), megabit, ergonomicsSoftware(cmyk_usb_panel,
|
|
||||||
mips_whitelist_duplex, cpa)));
|
|
||||||
if (5) {
|
|
||||||
managementNetwork += dma - boolean;
|
|
||||||
kilohertz_token = 2;
|
|
||||||
honeypot_affiliate_ergonomics = fiber;
|
|
||||||
}
|
|
||||||
mouseNorthbridge = byte(nybble_xmp_modem.horse_subnet(
|
|
||||||
analogThroughputService * graphicPoint, drop(daw_bit, dnsIntranet),
|
|
||||||
gateway_ospf), repository.domain_key.mouse(serverData(fileNetwork,
|
|
||||||
trim_duplex_file), cellTapeDirect, token_tooltip_mashup(
|
|
||||||
ripcordingMashup)));
|
|
||||||
module_it = honeypot_driver(client_cold_dvr(593902, ripping_frequency) +
|
|
||||||
coreLog.joystick(componentUdpLink), windows_expansion_touchscreen);
|
|
||||||
bashGigabit.external.reality(2, server_hardware_codec.flops.ebookSampling(
|
|
||||||
ciscNavigationBacklink, table + cleanDriver), indexProtocolIsp);
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
---
|
|
||||||
bookCollapseSection: true
|
|
||||||
weight: 20
|
|
||||||
---
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
---
|
|
||||||
bookHidden: true
|
|
||||||
---
|
|
||||||
|
|
||||||
# This page is hidden in menu
|
|
||||||
|
|
||||||
# Quondam non pater est dignior ille Eurotas
|
|
||||||
|
|
||||||
## Latent te facies
|
|
||||||
|
|
||||||
Lorem markdownum arma ignoscas vocavit quoque ille texit mandata mentis ultimus,
|
|
||||||
frementes, qui in vel. Hippotades Peleus [pennas
|
|
||||||
conscia](http://gratia.net/tot-qua.php) cuiquam Caeneus quas.
|
|
||||||
|
|
||||||
- Pater demittere evincitque reddunt
|
|
||||||
- Maxime adhuc pressit huc Danaas quid freta
|
|
||||||
- Soror ego
|
|
||||||
- Luctus linguam saxa ultroque prior Tatiumque inquit
|
|
||||||
- Saepe liquitur subita superata dederat Anius sudor
|
|
||||||
|
|
||||||
## Cum honorum Latona
|
|
||||||
|
|
||||||
O fallor [in sustinui
|
|
||||||
iussorum](http://www.spectataharundine.org/aquas-relinquit.html) equidem.
|
|
||||||
Nymphae operi oris alii fronde parens dumque, in auro ait mox ingenti proxima
|
|
||||||
iamdudum maius?
|
|
||||||
|
|
||||||
reality(burnDocking(apache_nanometer),
|
|
||||||
pad.property_data_programming.sectorBrowserPpga(dataMask, 37,
|
|
||||||
recycleRup));
|
|
||||||
intellectualVaporwareUser += -5 * 4;
|
|
||||||
traceroute_key_upnp /= lag_optical(android.smb(thyristorTftp));
|
|
||||||
surge_host_golden = mca_compact_device(dual_dpi_opengl, 33,
|
|
||||||
commerce_add_ppc);
|
|
||||||
if (lun_ipv) {
|
|
||||||
verticalExtranet(1, thumbnail_ttl, 3);
|
|
||||||
bar_graphics_jpeg(chipset - sector_xmp_beta);
|
|
||||||
}
|
|
||||||
|
|
||||||
## Fronde cetera dextrae sequens pennis voce muneris
|
|
||||||
|
|
||||||
Acta cretus diem restet utque; move integer, oscula non inspirat, noctisque
|
|
||||||
scelus! Nantemque in suas vobis quamvis, et labori!
|
|
||||||
|
|
||||||
var runtimeDiskCompiler = home - array_ad_software;
|
|
||||||
if (internic > disk) {
|
|
||||||
emoticonLockCron += 37 + bps - 4;
|
|
||||||
wan_ansi_honeypot.cardGigaflops = artificialStorageCgi;
|
|
||||||
simplex -= downloadAccess;
|
|
||||||
}
|
|
||||||
var volumeHardeningAndroid = pixel + tftp + onProcessorUnmount;
|
|
||||||
sector(memory(firewire + interlaced, wired));
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
---
|
|
||||||
weight: 10
|
|
||||||
---
|
|
||||||
|
|
||||||
# Ubi loqui
|
|
||||||
|
|
||||||
## Mentem genus facietque salire tempus bracchia
|
|
||||||
|
|
||||||
Lorem markdownum partu paterno Achillem. Habent amne generosi aderant ad pellem
|
|
||||||
nec erat sustinet merces columque haec et, dixit minus nutrit accipiam subibis
|
|
||||||
subdidit. Temeraria servatum agros qui sed fulva facta. Primum ultima, dedit,
|
|
||||||
suo quisque linguae medentes fixo: tum petis.
|
|
||||||
|
|
||||||
## Rapit vocant si hunc siste adspice
|
|
||||||
|
|
||||||
Ora precari Patraeque Neptunia, dixit Danae [Cithaeron
|
|
||||||
armaque](http://mersis-an.org/litoristum) maxima in **nati Coniugis** templis
|
|
||||||
fluidove. Effugit usus nec ingreditur agmen *ac manus* conlato. Nullis vagis
|
|
||||||
nequiquam vultibus aliquos altera *suum venis* teneas fretum. Armos [remotis
|
|
||||||
hoc](http://tutum.io/me) sine ferrea iuncta quam!
|
|
||||||
|
|
||||||
## Locus fuit caecis
|
|
||||||
|
|
||||||
Nefas discordemque domino montes numen tum humili nexilibusque exit, Iove. Quae
|
|
||||||
miror esse, scelerisque Melaneus viribus. Miseri laurus. Hoc est proposita me
|
|
||||||
ante aliquid, aura inponere candidioribus quidque accendit bella, sumpta.
|
|
||||||
Intravit quam erat figentem hunc, motus de fontes parvo tempestate.
|
|
||||||
|
|
||||||
iscsi_virus = pitch(json_in_on(eupViral),
|
|
||||||
northbridge_services_troubleshooting, personal(
|
|
||||||
firmware_rw.trash_rw_crm.device(interactive_gopher_personal,
|
|
||||||
software, -1), megabit, ergonomicsSoftware(cmyk_usb_panel,
|
|
||||||
mips_whitelist_duplex, cpa)));
|
|
||||||
if (5) {
|
|
||||||
managementNetwork += dma - boolean;
|
|
||||||
kilohertz_token = 2;
|
|
||||||
honeypot_affiliate_ergonomics = fiber;
|
|
||||||
}
|
|
||||||
mouseNorthbridge = byte(nybble_xmp_modem.horse_subnet(
|
|
||||||
analogThroughputService * graphicPoint, drop(daw_bit, dnsIntranet),
|
|
||||||
gateway_ospf), repository.domain_key.mouse(serverData(fileNetwork,
|
|
||||||
trim_duplex_file), cellTapeDirect, token_tooltip_mashup(
|
|
||||||
ripcordingMashup)));
|
|
||||||
module_it = honeypot_driver(client_cold_dvr(593902, ripping_frequency) +
|
|
||||||
coreLog.joystick(componentUdpLink), windows_expansion_touchscreen);
|
|
||||||
bashGigabit.external.reality(2, server_hardware_codec.flops.ebookSampling(
|
|
||||||
ciscNavigationBacklink, table + cleanDriver), indexProtocolIsp);
|
|
||||||
|
|
||||||
## Placabilis coactis nega ingemuit ignoscat nimia non
|
|
||||||
|
|
||||||
Frontis turba. Oculi gravis est Delphice; *inque praedaque* sanguine manu non.
|
|
||||||
|
|
||||||
if (ad_api) {
|
|
||||||
zif += usb.tiffAvatarRate(subnet, digital_rt) + exploitDrive;
|
|
||||||
gigaflops(2 - bluetooth, edi_asp_memory.gopher(queryCursor, laptop),
|
|
||||||
panel_point_firmware);
|
|
||||||
spyware_bash.statePopApplet = express_netbios_digital(
|
|
||||||
insertion_troubleshooting.brouter(recordFolderUs), 65);
|
|
||||||
}
|
|
||||||
recursionCoreRay = -5;
|
|
||||||
if (hub == non) {
|
|
||||||
portBoxVirus = soundWeb(recursive_card(rwTechnologyLeopard),
|
|
||||||
font_radcab, guidCmsScalable + reciprocalMatrixPim);
|
|
||||||
left.bug = screenshot;
|
|
||||||
} else {
|
|
||||||
tooltipOpacity = raw_process_permalink(webcamFontUser, -1);
|
|
||||||
executable_router += tape;
|
|
||||||
}
|
|
||||||
if (tft) {
|
|
||||||
bandwidthWeb *= social_page;
|
|
||||||
} else {
|
|
||||||
regular += 611883;
|
|
||||||
thumbnail /= system_lag_keyboard;
|
|
||||||
}
|
|
||||||
|
|
||||||
## Caesorum illa tu sentit micat vestes papyriferi
|
|
||||||
|
|
||||||
Inde aderam facti; Theseus vis de tauri illa peream. Oculos **uberaque** non
|
|
||||||
regisque vobis cursuque, opus venit quam vulnera. Et maiora necemque, lege modo;
|
|
||||||
gestanda nitidi, vero? Dum ne pectoraque testantur.
|
|
||||||
|
|
||||||
Venasque repulsa Samos qui, exspectatum eram animosque hinc, [aut
|
|
||||||
manes](http://www.creveratnon.net/apricaaetheriis), Assyrii. Cupiens auctoribus
|
|
||||||
pariter rubet, profana magni super nocens. Vos ius sibilat inpar turba visae
|
|
||||||
iusto! Sedes ante dum superest **extrema**.
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
---
|
|
||||||
title: With ToC
|
|
||||||
weight: 1
|
|
||||||
---
|
|
||||||
# Caput vino delphine in tamen vias
|
|
||||||
|
|
||||||
## Cognita laeva illo fracta
|
|
||||||
|
|
||||||
Lorem markdownum pavent auras, surgit nunc cingentibus libet **Laomedonque que**
|
|
||||||
est. Pastor [An](http://est.org/ire.aspx) arbor filia foedat, ne [fugit
|
|
||||||
aliter](http://www.indiciumturbam.org/moramquid.php), per. Helicona illas et
|
|
||||||
callida neptem est *Oresitrophos* caput, dentibus est venit. Tenet reddite
|
|
||||||
[famuli](http://www.antro-et.net/) praesentem fortibus, quaeque vis foret si
|
|
||||||
frondes *gelidos* gravidae circumtulit [inpulit armenta
|
|
||||||
nativum](http://incurvasustulit.io/illi-virtute.html).
|
|
||||||
|
|
||||||
1. Te at cruciabere vides rubentis manebo
|
|
||||||
2. Maturuit in praetemptat ruborem ignara postquam habitasse
|
|
||||||
3. Subitarum supplevit quoque fontesque venabula spretis modo
|
|
||||||
4. Montis tot est mali quasque gravis
|
|
||||||
5. Quinquennem domus arsit ipse
|
|
||||||
6. Pellem turis pugnabant locavit
|
|
||||||
|
|
||||||
## Natus quaerere
|
|
||||||
|
|
||||||
Pectora et sine mulcere, coniuge dum tincta incurvae. Quis iam; est dextra
|
|
||||||
Peneosque, metuis a verba, primo. Illa sed colloque suis: magno: gramen, aera
|
|
||||||
excutiunt concipit.
|
|
||||||
|
|
||||||
> Phrygiae petendo suisque extimuit, super, pars quod audet! Turba negarem.
|
|
||||||
> Fuerat attonitus; et dextra retinet sidera ulnas undas instimulat vacuae
|
|
||||||
> generis? *Agnus* dabat et ignotis dextera, sic tibi pacis **feriente at mora**
|
|
||||||
> euhoeque *comites hostem* vestras Phineus. Vultuque sanguine dominoque [metuit
|
|
||||||
> risi](http://iuvat.org/eundem.php) fama vergit summaque meus clarissimus
|
|
||||||
> artesque tinguebat successor nominis cervice caelicolae.
|
|
||||||
|
|
||||||
## Limitibus misere sit
|
|
||||||
|
|
||||||
Aurea non fata repertis praerupit feruntur simul, meae hosti lentaque *citius
|
|
||||||
levibus*, cum sede dixit, Phaethon texta. *Albentibus summos* multifidasque
|
|
||||||
iungitur loquendi an pectore, mihi ursaque omnia adfata, aeno parvumque in animi
|
|
||||||
perlucentes. Epytus agis ait vixque clamat ornum adversam spondet, quid sceptra
|
|
||||||
ipsum **est**. Reseret nec; saeva suo passu debentia linguam terga et aures et
|
|
||||||
cervix [de](http://www.amnem.io/pervenit.aspx) ubera. Coercet gelidumque manus,
|
|
||||||
doluit volvitur induta?
|
|
||||||
|
|
||||||
## Enim sua
|
|
||||||
|
|
||||||
Iuvenilior filia inlustre templa quidem herbis permittat trahens huic. In
|
|
||||||
cruribus proceres sole crescitque *fata*, quos quos; merui maris se non tamen
|
|
||||||
in, mea.
|
|
||||||
|
|
||||||
## Germana aves pignus tecta
|
|
||||||
|
|
||||||
Mortalia rudibusque caelum cognosceret tantum aquis redito felicior texit, nec,
|
|
||||||
aris parvo acre. Me parum contulerant multi tenentem, gratissime suis; vultum tu
|
|
||||||
occupat deficeret corpora, sonum. E Actaea inplevit Phinea concepit nomenque
|
|
||||||
potest sanguine captam nulla et, in duxisses campis non; mercede. Dicere cur
|
|
||||||
Leucothoen obitum?
|
|
||||||
|
|
||||||
Postibus mittam est *nubibus principium pluma*, exsecratur facta et. Iunge
|
|
||||||
Mnemonidas pallamque pars; vere restitit alis flumina quae **quoque**, est
|
|
||||||
ignara infestus Pyrrha. Di ducis terris maculatum At sede praemia manes
|
|
||||||
nullaque!
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
---
|
|
||||||
title: Without ToC
|
|
||||||
weight: 2
|
|
||||||
bookToc: false
|
|
||||||
---
|
|
||||||
|
|
||||||
# At me ipso nepotibus nunc celebratior genus
|
|
||||||
|
|
||||||
## Tanto oblite
|
|
||||||
|
|
||||||
Lorem markdownum pectora novis patenti igne sua opus aurae feras materiaque
|
|
||||||
illic demersit imago et aristas questaque posset. Vomit quoque suo inhaesuro
|
|
||||||
clara. Esse cumque, per referri triste. Ut exponit solisque communis in tendens
|
|
||||||
vincetis agisque iamque huic bene ante vetat omina Thebae rates. Aeacus servat
|
|
||||||
admonitu concidit, ad resimas vultus et rugas vultu **dignamque** Siphnon.
|
|
||||||
|
|
||||||
Quam iugulum regia simulacra, plus meruit humo pecorumque haesit, ab discedunt
|
|
||||||
dixit: ritu pharetramque. Exul Laurenti orantem modo, per densum missisque labor
|
|
||||||
manibus non colla unum, obiectat. Tu pervia collo, fessus quae Cretenque Myconon
|
|
||||||
crate! Tegumenque quae invisi sudore per vocari quaque plus ventis fluidos. Nodo
|
|
||||||
perque, fugisse pectora sorores.
|
|
||||||
|
|
||||||
## Summe promissa supple vadit lenius
|
|
||||||
|
|
||||||
Quibus largis latebris aethera versato est, ait sentiat faciemque. Aequata alis
|
|
||||||
nec Caeneus exululat inclite corpus est, ire **tibi** ostendens et tibi. Rigent
|
|
||||||
et vires dique possent lumina; **eadem** dixit poma funeribus paret et felix
|
|
||||||
reddebant ventis utile lignum.
|
|
||||||
|
|
||||||
1. Remansit notam Stygia feroxque
|
|
||||||
2. Et dabit materna
|
|
||||||
3. Vipereas Phrygiaeque umbram sollicito cruore conlucere suus
|
|
||||||
4. Quarum Elis corniger
|
|
||||||
5. Nec ieiunia dixit
|
|
||||||
|
|
||||||
Vertitur mos ortu ramosam contudit dumque; placabat ac lumen. Coniunx Amoris
|
|
||||||
spatium poenamque cavernis Thebae Pleiadasque ponunt, rapiare cum quae parum
|
|
||||||
nimium rima.
|
|
||||||
|
|
||||||
## Quidem resupinus inducto solebat una facinus quae
|
|
||||||
|
|
||||||
Credulitas iniqua praepetibus paruit prospexit, voce poena, sub rupit sinuatur,
|
|
||||||
quin suum ventorumque arcadiae priori. Soporiferam erat formamque, fecit,
|
|
||||||
invergens, nymphae mutat fessas ait finge.
|
|
||||||
|
|
||||||
1. Baculum mandataque ne addere capiti violentior
|
|
||||||
2. Altera duas quam hoc ille tenues inquit
|
|
||||||
3. Sicula sidereus latrantis domoque ratae polluit comites
|
|
||||||
4. Possit oro clausura namque se nunc iuvenisque
|
|
||||||
5. Faciem posuit
|
|
||||||
6. Quodque cum ponunt novercae nata vestrae aratra
|
|
||||||
|
|
||||||
Ite extrema Phrygiis, patre dentibus, tonso perculit, enim blanda, manibus fide
|
|
||||||
quos caput armis, posse! Nocendo fas Alcyonae lacertis structa ferarum manus
|
|
||||||
fulmen dubius, saxa caelum effuge extremis fixum tumor adfecit **bella**,
|
|
||||||
potentes? Dum nec insidiosa tempora tegit
|
|
||||||
[spirarunt](http://mihiferre.net/iuvenes-peto.html). Per lupi pars foliis,
|
|
||||||
porreximus humum negant sunt subposuere Sidone steterant auro. Memoraverit sine:
|
|
||||||
ferrum idem Orion caelum heres gerebat fixis?
|
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
---
|
||||||
|
weight: 20
|
||||||
|
---
|
||||||
|
|
||||||
|
# Getting Started
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- [Hugo](https://gohugo.io/installation/) **extended** edition (required for SCSS processing)
|
||||||
|
- [Git](https://git-scm.com/downloads) (for theme installation using git submodules)
|
||||||
|
- [Go](https://go.dev/dl/) (for theme installation using Hugo Modules)
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
Use the [starter repository](https://github.com/alex-shpak/hugo-book-starter) to get a working site in seconds. It can also be used as a [GitHub template](https://github.com/alex-shpak/hugo-book-starter/generate) to create a new repository.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git clone https://github.com/alex-shpak/hugo-book-starter documentation
|
||||||
|
cd documentation
|
||||||
|
git submodule update --init --remote
|
||||||
|
hugo server --minify
|
||||||
|
```
|
||||||
|
|
||||||
|
By default, the theme renders pages under `docs/` section as the sidebar menu. See [Content Organization](/docs/content/) for details.
|
||||||
|
|
||||||
|
## Installation Methods
|
||||||
|
|
||||||
|
{{< tabs >}}
|
||||||
|
|
||||||
|
{{% tab "Git Submodule" %}}
|
||||||
|
The simplest approach. The theme is vendored directly into your repository.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git init
|
||||||
|
git submodule add https://github.com/alex-shpak/hugo-book themes/hugo-book
|
||||||
|
```
|
||||||
|
|
||||||
|
Set the theme in your config
|
||||||
|
|
||||||
|
```toml {filename=hugo.toml}
|
||||||
|
theme = 'hugo-book'
|
||||||
|
```
|
||||||
|
|
||||||
|
To update the theme later
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git submodule update --remote --merge
|
||||||
|
```
|
||||||
|
{{% /tab %}}
|
||||||
|
|
||||||
|
{{% tab "Hugo Module" %}}
|
||||||
|
Uses [Hugo Modules](https://gohugo.io/hugo-modules/) (requires [Go](https://go.dev/dl/)).
|
||||||
|
|
||||||
|
Initialize your site as a module
|
||||||
|
|
||||||
|
```shell
|
||||||
|
hugo mod init github.com/user/my-docs
|
||||||
|
```
|
||||||
|
|
||||||
|
Add the theme import to your config
|
||||||
|
|
||||||
|
```toml {filename=hugo.toml}
|
||||||
|
[module]
|
||||||
|
[[module.imports]]
|
||||||
|
path = 'github.com/alex-shpak/hugo-book'
|
||||||
|
```
|
||||||
|
|
||||||
|
To update the theme later
|
||||||
|
|
||||||
|
```shell
|
||||||
|
hugo mod get -u
|
||||||
|
```
|
||||||
|
{{% /tab %}}
|
||||||
|
|
||||||
|
{{% tab "Manual Download" %}}
|
||||||
|
Download the theme from [GitHub releases](https://github.com/alex-shpak/hugo-book/releases) and extract it to `themes/hugo-book`.
|
||||||
|
|
||||||
|
Set the theme in your config
|
||||||
|
|
||||||
|
```toml {filename=hugo.toml}
|
||||||
|
theme = 'hugo-book'
|
||||||
|
```
|
||||||
|
|
||||||
|
To update, download and extract the new release again.
|
||||||
|
{{% /tab %}}
|
||||||
|
|
||||||
|
{{< /tabs >}}
|
||||||
|
|
||||||
|
## Minimal Configuration
|
||||||
|
|
||||||
|
```toml {filename=hugo.toml}
|
||||||
|
baseURL = 'https://example.com/'
|
||||||
|
title = 'My Documentation'
|
||||||
|
theme = 'hugo-book'
|
||||||
|
|
||||||
|
# Required for mermaid and katex shortcodes
|
||||||
|
[markup.goldmark.renderer]
|
||||||
|
unsafe = true
|
||||||
|
```
|
||||||
|
|
||||||
|
See [Configuration](/docs/configuration/) for the full list of parameters.
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
weight: 10
|
||||||
|
---
|
||||||
|
# Introduction
|
||||||
|
|
||||||
|
Hugo Book is a documentation theme for [Hugo](https://gohugo.io). It provides a clean, readable layout for technical docs with minimal dependencies and no build tooling beyond Hugo itself.
|
||||||
|
|
||||||
|
## Design Goals
|
||||||
|
|
||||||
|
Minimalism over features.
|
||||||
|
: The theme ships only what most documentation sites need: a sidebar menu, search, and a few shortcodes. There is no attempt to cover every use case. CSS is written by hand, not generated by a framework. JavaScript is optional for core navigation.
|
||||||
|
|
||||||
|
Theme as an extendable base.
|
||||||
|
: Hugo Book is meant to be extended and adapted. 'Inject' partials, custom SCSS, and Hugo's template override system let you change any part of the theme without modifying the source, while keeping the codebase intentionally small.
|
||||||
|
|
||||||
|
Long-term maintainability.
|
||||||
|
: Few dependencies means fewer things to break. The theme avoids heavy JavaScript libraries, CSS frameworks, and complex build pipelines.
|
||||||
|
|
||||||
|
[Get Started](/docs/getting-started/)
|
||||||
|
|
||||||
|
## Links
|
||||||
|
- [Source code](https://github.com/alex-shpak/hugo-book)
|
||||||
|
- [Hugo documentation](https://gohugo.io/documentation/)
|
||||||
@@ -1,3 +1,20 @@
|
|||||||
---
|
---
|
||||||
bookFlatSection: true
|
weight: 60
|
||||||
|
bookCollapseSection: true
|
||||||
---
|
---
|
||||||
|
|
||||||
|
# Shortcodes
|
||||||
|
|
||||||
|
Hugo Book includes shortcodes for common documentation patterns. All interactive shortcodes work without JavaScript using CSS-only techniques.
|
||||||
|
|
||||||
|
Hugo shortcodes use two delimiter styles:
|
||||||
|
|
||||||
|
`{{</* shortcode */>}}`
|
||||||
|
: Renders inner content as plain HTML. Use for shortcodes that don't contain markdown.
|
||||||
|
|
||||||
|
`{{%/* shortcode */%}}`
|
||||||
|
: Processes inner content as markdown. Use when the shortcode body contains markdown formatting.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> Use `{{%/* shortcode */%}}` when the body contains markdown that needs to be rendered. `{{</* shortcode */>}}` passes content as-is without markdown processing.
|
||||||
|
> When nesting shortcodes (e.g. tabs inside columns), the outer shortcode must use `{{%/* shortcode */%}}` for the inner shortcodes and markdown to be processed.
|
||||||
|
|||||||
@@ -1,17 +1,21 @@
|
|||||||
# Asciinema
|
# Asciinema
|
||||||
|
|
||||||
Asciinema shortcode integrates asciinema player into the markdown page.
|
Embed terminal recordings with the [Asciinema](https://asciinema.org/) player.
|
||||||
|
|
||||||
|
## Syntax
|
||||||
|
|
||||||
```tpl
|
```tpl
|
||||||
{{</* asciinema
|
{{</* asciinema
|
||||||
cast="asciinema-627097.cast"
|
cast="recording.cast"
|
||||||
or
|
|
||||||
cast="https://asciinema.org/a/vJNKUQFjuh7qKI2j3OoaKs8Jk.cast"
|
|
||||||
loop=true
|
loop=true
|
||||||
autoplay=true
|
autoplay=true
|
||||||
speed=2 */>}}
|
speed=2 */>}}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The `cast` parameter accepts page resources, site resources, or remote URLs.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
{{< asciinema
|
{{< asciinema
|
||||||
cast="asciinema-627097.cast"
|
cast="asciinema-627097.cast"
|
||||||
loop=true
|
loop=true
|
||||||
@@ -20,6 +24,9 @@ Asciinema shortcode integrates asciinema player into the markdown page.
|
|||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
All parameters added to the shortcode will be transformed to options for Asciinema player, expect `cast` parameter that is used to locate cast file. Cast file follows same rules as portable image, it could be site resource, page resource or remote file URL.
|
`cast`
|
||||||
|
: Path to the `.cast` file. Can be a local resource or a remote URL.
|
||||||
|
|
||||||
[List of Asciinema options](https://docs.asciinema.org/manual/player/options/)
|
All other parameters are passed directly to the Asciinema player. See the [Asciinema player options](https://docs.asciinema.org/manual/player/options/) for the full list.
|
||||||
|
|
||||||
|
Common options: `autoplay`, `loop`, `speed`, `theme`, `cols`, `rows`, `idleTimeLimit`, `preload`.
|
||||||
|
|||||||
@@ -1,13 +1,26 @@
|
|||||||
# Buttons
|
# Buttons
|
||||||
|
|
||||||
Buttons are styled links that can lead to local page or external link.
|
Styled links that can point to local pages or external URLs. External links automatically open in a new tab.
|
||||||
|
|
||||||
## Example
|
## Syntax
|
||||||
|
|
||||||
```tpl
|
```tpl
|
||||||
{{</* button relref="/" [class="..."] */>}}Get Home{{</* /button */>}}
|
{{</* button relref="/" [class="..."] */>}}Get Home{{</* /button */>}}
|
||||||
{{</* button href="https://github.com/alex-shpak/hugo-book" */>}}Contribute{{</* /button */>}}
|
{{</* button href="https://github.com/alex-shpak/hugo-book" */>}}Github{{</* /button */>}}
|
||||||
```
|
```
|
||||||
|
|
||||||
{{<button href="/">}}Get Home{{</button>}}
|
## Example
|
||||||
{{<button href="https://github.com/alex-shpak/hugo-book">}}Contribute{{</button>}}
|
|
||||||
|
{{<button href="/">}}Home{{</button>}}
|
||||||
|
{{<button href="https://github.com/alex-shpak/hugo-book">}}Github{{</button>}}
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
`href`
|
||||||
|
: URL for external links.
|
||||||
|
|
||||||
|
`relref`
|
||||||
|
: Hugo page reference for internal links.
|
||||||
|
|
||||||
|
`class`
|
||||||
|
: Additional CSS classes.
|
||||||
|
|||||||
@@ -1,65 +1,47 @@
|
|||||||
# Columns
|
# Columns
|
||||||
|
|
||||||
Columns help organize shorter pieces of content horizontally for readability. `columns` shortcode styles markdown list as up to 3 columns.
|
Organize content horizontally. Renders a markdown list as up to 3 side-by-side columns.
|
||||||
|
|
||||||
## Example
|
## Syntax
|
||||||
|
|
||||||
```tpl
|
```tpl
|
||||||
{{%/* columns [ratio="1:1"] [class="..."] */%}}
|
{{%/* columns [ratio="1:1"] [class="..."] */%}}
|
||||||
- ### Left Content
|
- ### Left
|
||||||
Lorem markdownum insigne...
|
Content...
|
||||||
|
|
||||||
- ### Mid Content
|
- ### Right
|
||||||
Lorem markdownum insigne...
|
Content...
|
||||||
|
|
||||||
- ### Right Content
|
|
||||||
Lorem markdownum insigne...
|
|
||||||
{{%/* /columns */%}}
|
{{%/* /columns */%}}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
{{% columns %}}
|
{{% columns %}}
|
||||||
- ### Left Content
|
- ### File-Tree Menu
|
||||||
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
The sidebar menu is automatically generated from your content directory structure. Pages are ordered by `weight` frontmatter.
|
||||||
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
|
|
||||||
Miseratus fonte Ditis conubia.
|
|
||||||
|
|
||||||
- ### Mid Content
|
- ### Hugo Menus
|
||||||
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
Additional menu entries can be added above or below the file-tree using Hugo's standard menu system in your site config.
|
||||||
stringit, frustra Saturnius uteroque inter!
|
|
||||||
|
|
||||||
- ### Right Content
|
- ### Landing Menu
|
||||||
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
Pages with `layout: landing` use a separate menu defined under `menu.home` for header navigation.
|
||||||
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
|
|
||||||
Miseratus fonte Ditis conubia.
|
|
||||||
{{% /columns %}}
|
{{% /columns %}}
|
||||||
|
|
||||||
## Settings size ratio for columns
|
## Custom Ratio
|
||||||
|
|
||||||
|
Set relative column widths with the `ratio` parameter
|
||||||
|
|
||||||
```tpl
|
```tpl
|
||||||
{{%/* columns ratio="1:2" */%}}
|
{{%/* columns ratio="1:2" */%}}
|
||||||
- ## x1 Column
|
- ### Sidebar
|
||||||
Lorem markdownum insigne...
|
- ### Content Area
|
||||||
|
|
||||||
- ## x2 Column
|
|
||||||
Lorem markdownum insigne...
|
|
||||||
{{%/* /columns */%}}
|
{{%/* /columns */%}}
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% columns ratio="1:2" %}}
|
{{% columns ratio="1:2" %}}
|
||||||
- ### x1 Column
|
- ### File-Tree Menu
|
||||||
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
The sidebar menu is automatically generated from your content directory structure. Pages are ordered by `weight` frontmatter.
|
||||||
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
|
|
||||||
Miseratus fonte Ditis conubia.
|
|
||||||
|
|
||||||
- ### x2 Column
|
- ### Hugo Menus
|
||||||
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
Additional menu entries can be added above or below the file-tree using Hugo's standard menu system in your site config.
|
||||||
stringit, frustra Saturnius uteroque inter!
|
|
||||||
|
|
||||||
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
|
||||||
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
|
|
||||||
Miseratus fonte Ditis conubia.
|
|
||||||
{{% /columns %}}
|
{{% /columns %}}
|
||||||
|
|||||||
@@ -1,30 +1,37 @@
|
|||||||
# Details
|
# Details
|
||||||
|
|
||||||
Details shortcode is a helper for `details` html5 element. To collapse the details either omit the `open`
|
Collapsible content using the HTML5 `<details>` element.
|
||||||
keyword when using positional arguments or set `open=false` when using parameters.
|
|
||||||
|
|
||||||
## Example with positional arguments
|
## Syntax
|
||||||
|
|
||||||
|
Positional arguments:
|
||||||
```tpl
|
```tpl
|
||||||
{{%/* details "Title" [open] */%}}
|
{{%/* details "Title" [open] */%}}
|
||||||
## Markdown content
|
Markdown content
|
||||||
Lorem markdownum insigne...
|
|
||||||
{{%/* /details */%}}
|
{{%/* /details */%}}
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% details "Title" open %}}
|
Named parameters:
|
||||||
## Markdown content
|
|
||||||
Lorem markdownum insigne...
|
|
||||||
{{% /details %}}
|
|
||||||
|
|
||||||
## Example with parameters
|
|
||||||
```tpl
|
```tpl
|
||||||
{{%/* details title="Title" open=true */%}}
|
{{%/* details title="Title" open=true */%}}
|
||||||
## Markdown content
|
Markdown content
|
||||||
Lorem markdownum insigne...
|
|
||||||
{{%/* /details */%}}
|
{{%/* /details */%}}
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% details title="Title" open=true %}}
|
## Example
|
||||||
## Markdown content
|
|
||||||
Lorem markdownum insigne...
|
{{% details "What Hugo version is required?" %}}
|
||||||
|
Hugo Book requires Hugo {x} or later, extended edition. The extended edition is needed for SCSS processing.
|
||||||
{{% /details %}}
|
{{% /details %}}
|
||||||
|
|
||||||
|
{{% details "How do I override the theme?" open %}}
|
||||||
|
Create matching files in your project's `layouts/` or `assets/` directory. Hugo's lookup order will use your files over the theme's.
|
||||||
|
{{% /details %}}
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
`title` (or first positional argument)
|
||||||
|
: The summary text shown when collapsed.
|
||||||
|
|
||||||
|
`open` (or second positional argument)
|
||||||
|
: Start expanded. Default: collapsed.
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
---
|
---
|
||||||
bookCollapseSection: true
|
bookCollapseSection: true
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,32 +1,43 @@
|
|||||||
# Badges
|
# Badges
|
||||||
|
|
||||||
> [!WARNING]
|
Inline labels for annotating content with status, versions, or metadata.
|
||||||
> Experimental, could change in the future or be removed
|
|
||||||
|
|
||||||
Badges can be used to annotate your pages with additional information or mark specific places in markdown content.
|
## Syntax
|
||||||
|
|
||||||
{{< badge title="Title" value="Value" >}}
|
```tpl
|
||||||
{{< badge style="info" title="Hugo" value="0.147.6" >}}
|
{{</* badge style="info" title="Hugo" value="0.158" */>}}
|
||||||
{{< badge style="success" title="Build" value="Passing" >}}
|
```
|
||||||
{{< badge style="warning" title="Coverage" value="25%" >}}
|
|
||||||
{{< badge style="danger" title="Issues" value="120" >}}
|
|
||||||
|
|
||||||
## Examples
|
## Styles
|
||||||
|
|
||||||
| Shortcode | Output |
|
| Shortcode | Output |
|
||||||
| -- | -- |
|
| -- | -- |
|
||||||
| `{{</* badge style="info" title="hugo" value="0.147.6" */>}}` | {{< badge style="info" title="Hugo" value="0.147.6" >}} |
|
| `{{</* badge style="info" title="Hugo" value="0.158" */>}}` | {{< badge style="info" title="Hugo" value="0.158" >}} |
|
||||||
| `{{</* badge style="success" title="Build" value="Passing" */>}}` | {{< badge style="success" title="Build" value="Passing" >}} |
|
| `{{</* badge style="success" title="Build" value="Passing" */>}}` | {{< badge style="success" title="Build" value="Passing" >}} |
|
||||||
| `{{</* badge style="warning" title="Coverage" value="25%" */>}}` | {{< badge style="warning" title="Coverage" value="25%" >}} |
|
| `{{</* badge style="warning" title="Coverage" value="25%" */>}}` | {{< badge style="warning" title="Coverage" value="25%" >}} |
|
||||||
| `{{</* badge style="danger" title="Issues" value="120" */>}}` | {{< badge style="danger" title="Issues" value="120" >}} |
|
| `{{</* badge style="danger" title="Issues" value="120" */>}}` | {{< badge style="danger" title="Issues" value="120" >}} |
|
||||||
| | |
|
| | |
|
||||||
| `{{</* badge style="info" title="Title" */>}}` | {{< badge style="info" title="Title" >}} |
|
| `{{</* badge style="info" title="Title" */>}}` | {{< badge style="info" title="Title" >}} |
|
||||||
| `{{</* badge style="info" value="Value" */>}}` | {{< badge style="info" value="Value" >}} |
|
| `{{</* badge style="info" value="Value" */>}}` | {{< badge style="info" value="Value" >}} |
|
||||||
| `{{</* badge title="Default" */>}}` | {{< badge value="Default" >}} |
|
| `{{</* badge value="Default" */>}}` | {{< badge value="Default" >}} |
|
||||||
|
|
||||||
## Use in links
|
## Use in Links
|
||||||
|
|
||||||
|
Wrap a badge in a markdown link
|
||||||
|
|
||||||
A badge can be wrapped in markdown link producing following result: [{{< badge title="Hugo" value="0.147.6" >}}](https://github.com/gohugoio/hugo/releases/tag/v0.147.6)
|
|
||||||
```tpl
|
```tpl
|
||||||
[{{</* badge title="Hugo" value="0.147.6" */>}}](https://github.com/gohugoio/hugo/releases/tag/v0.147.6)
|
[{{</* badge title="Hugo" value="0.158" */>}}](https://github.com/gohugoio/hugo/releases/tag/v0.158.0)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
[{{< badge title="Hugo" value="0.158" >}}](https://github.com/gohugoio/hugo/releases/tag/v0.158.0)
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
`style`
|
||||||
|
: Visual style. One of: `default`, `info`, `success`, `warning`, `danger`, `note`, `tip`, `important`, `caution`.
|
||||||
|
|
||||||
|
`title`
|
||||||
|
: Label text (left side).
|
||||||
|
|
||||||
|
`value`
|
||||||
|
: Value text (right side).
|
||||||
|
|||||||
@@ -1,33 +1,47 @@
|
|||||||
# Cards
|
# Cards
|
||||||
|
|
||||||
> [!WARNING]
|
Content blocks with optional images and links. Often used with [Columns](/docs/shortcodes/columns) for grid layouts.
|
||||||
> Experimental, could change in the future or be removed
|
|
||||||
|
## Syntax
|
||||||
|
|
||||||
|
```tpl
|
||||||
|
{{</* card [href="..."] [image="..."] [title="..."] */>}}
|
||||||
|
Markdown content
|
||||||
|
{{</* /card */>}}
|
||||||
|
```
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
{{% columns %}}
|
{{% columns %}}
|
||||||
- {{< card image="placeholder.svg" >}}
|
- {{< card image="placeholder.svg" >}}
|
||||||
### Line 1
|
### With Image
|
||||||
Line 2
|
Cards can display an image above the content.
|
||||||
{{< /card >}}
|
{{< /card >}}
|
||||||
|
|
||||||
- {{< card image="placeholder.svg" >}}
|
|
||||||
This is tab MacOS content.
|
|
||||||
{{< /card >}}
|
|
||||||
{{% /columns %}}
|
|
||||||
|
|
||||||
{{% columns %}}
|
|
||||||
- {{< card href="/docs/shortcodes/experimental/cards" >}}
|
- {{< card href="/docs/shortcodes/experimental/cards" >}}
|
||||||
**Markdown**
|
### With Link {anchor=false}
|
||||||
Suspendisse sed congue orci, eu congue metus. Nullam feugiat urna massa.
|
When `href` is set, the entire card becomes clickable.
|
||||||
{{< /card >}}
|
|
||||||
|
|
||||||
- {{< card >}}
|
|
||||||
Suspendisse sed congue orci, eu congue metus. Nullam feugiat urna massa, et fringilla metus consectetur molestie.
|
|
||||||
{{< /card >}}
|
{{< /card >}}
|
||||||
|
|
||||||
- {{< card title="Card" >}}
|
- {{< card title="Card" >}}
|
||||||
### Heading
|
### Plain Card
|
||||||
This is tab MacOS content.
|
A basic card with no image or link, used for grouping related content.
|
||||||
{{< /card >}}
|
{{< /card >}}
|
||||||
{{% /columns %}}
|
{{% /columns %}}
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
`href`
|
||||||
|
: Makes the card a link. The entire card area becomes clickable.
|
||||||
|
|
||||||
|
`image`
|
||||||
|
: Path to an image displayed above the card content. Supports page resources and URLs.
|
||||||
|
|
||||||
|
`title`
|
||||||
|
: Accessible title for the card.
|
||||||
|
|
||||||
|
`alt`
|
||||||
|
: Alt text for the card image.
|
||||||
|
|
||||||
|
`class`
|
||||||
|
: Additional CSS classes.
|
||||||
|
|||||||
@@ -1,33 +1,30 @@
|
|||||||
# Images
|
# Images
|
||||||
|
|
||||||
> [!WARNING]
|
Enhanced image display with click-to-expand behavior.
|
||||||
> Experimental, could change in the future or be removed
|
|
||||||
|
|
||||||
Image shortcode produces an image that can be clicked to expand.
|
## Syntax
|
||||||
|
|
||||||
|
```tpl
|
||||||
|
{{</* image src="photo.jpg" alt="Description" title="Caption" loading="lazy" */>}}
|
||||||
|
```
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
```go-html-template
|
{{< image src="placeholder.svg" alt="Placeholder image" title="Click to expand" loading="lazy" >}}
|
||||||
{{</* image src="placeholder.svg" alt="A placeholder" title="A placeholder" loading="lazy" */>}}
|
|
||||||
```
|
|
||||||
{{< image src="placeholder.svg" alt="A placeholder" title="A placeholder" loading="lazy" >}}
|
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
`src` {{< badge style="warning" title="Required" >}}
|
`src`
|
||||||
: The link to the image
|
: Path to the image. Supports page resources, site resources, and URLs.
|
||||||
|
|
||||||
`class` {{< badge style="info" title="Optional" >}}
|
`alt`
|
||||||
: An optional CSS class name that will be applied to the `img` element
|
: Alternate text for accessibility.
|
||||||
|
|
||||||
`alt` {{< badge style="info" title="Optional" >}}
|
|
||||||
: An optional alternate text for the image
|
|
||||||
|
|
||||||
`title` {{< badge style="info" title="Optional" >}}
|
|
||||||
: An optional title for the image
|
|
||||||
|
|
||||||
`loading` {{< badge style="info" title="Optional" >}}
|
|
||||||
: Sets `loading` control for the image: `lazy`, `eager` or `auto`
|
|
||||||
|
|
||||||
|
`title`
|
||||||
|
: Caption displayed below the image.
|
||||||
|
|
||||||
|
`loading`
|
||||||
|
: Loading strategy: `lazy`, `eager`, or `auto`.
|
||||||
|
|
||||||
|
`class`
|
||||||
|
: Additional CSS classes on the `<img>` element.
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
bookHidden: true
|
||||||
|
---
|
||||||
|
|
||||||
|
# Section
|
||||||
|
|
||||||
|
Render child pages of the current section as a definition list with titles and descriptions.
|
||||||
|
|
||||||
|
## Syntax
|
||||||
|
|
||||||
|
```tpl
|
||||||
|
{{</* section [summary] */>}}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
`summary`
|
||||||
|
: When present, includes the page summary below each title.
|
||||||
@@ -1,75 +1,64 @@
|
|||||||
# Hints
|
# Hints
|
||||||
|
|
||||||
Hint shortcode can be used as a hint/alert/notification block.
|
Callout blocks for notes, warnings, and other contextual messages. Also supports standard GitHub markdown alerts.
|
||||||
|
|
||||||
|
## Syntax
|
||||||
|
|
||||||
```tpl
|
```tpl
|
||||||
{{%/* hint [info|success|warning|danger] */%}}
|
{{%/* hint [info|success|warning|danger] */%}}
|
||||||
**Markdown content**
|
Markdown content
|
||||||
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
|
||||||
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
{{%/* /hint */%}}
|
{{%/* /hint */%}}
|
||||||
|
```
|
||||||
|
|
||||||
|
Or using markdown alerts
|
||||||
|
|
||||||
|
```markdown
|
||||||
> [!NOTE|TIP|IMPORTANT|WARNING|CAUTION]
|
> [!NOTE|TIP|IMPORTANT|WARNING|CAUTION]
|
||||||
> **Markdown content**
|
> Markdown content
|
||||||
> Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
|
||||||
> stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
{{% hint %}}
|
{{% hint %}}
|
||||||
**Markdown content**
|
**Default hint**
|
||||||
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
Without a specified type.
|
||||||
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
{{% /hint %}}
|
{{% /hint %}}
|
||||||
|
|
||||||
{{% hint info %}}
|
{{% hint info %}}
|
||||||
**Markdown content**
|
**Info**
|
||||||
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
Use for supplementary information that helps the reader.
|
||||||
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
{{% /hint %}}
|
{{% /hint %}}
|
||||||
|
|
||||||
{{% hint success %}}
|
{{% hint success %}}
|
||||||
**Markdown content**
|
**Success**
|
||||||
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
Use to highlight a recommended approach or positive outcome.
|
||||||
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
{{% /hint %}}
|
{{% /hint %}}
|
||||||
|
|
||||||
{{% hint warning %}}
|
{{% hint warning %}}
|
||||||
**Markdown content**
|
**Warning**
|
||||||
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
Use for important caveats or potential issues.
|
||||||
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
{{% /hint %}}
|
{{% /hint %}}
|
||||||
|
|
||||||
{{% hint danger %}}
|
{{% hint danger %}}
|
||||||
**Markdown content**
|
**Danger**
|
||||||
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
Use for critical warnings about breaking changes or data loss.
|
||||||
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
{{% /hint %}}
|
{{% /hint %}}
|
||||||
|
|
||||||
## Support for markdown alerts
|
## Markdown Alerts
|
||||||
|
|
||||||
|
Standard GitHub markdown alert syntax is also supported:
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> **Note**
|
> The theme requires Hugo **extended** edition for SCSS processing.
|
||||||
> Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
|
||||||
> stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
|
|
||||||
> [!TIP]
|
> [!TIP]
|
||||||
> **Tip**
|
> Set `disablePathToLower = true` in your config to preserve URL casing.
|
||||||
> Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
|
||||||
> stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
|
|
||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
> **Important**
|
> The `unsafe = true` goldmark setting is required for Mermaid and KaTeX shortcodes.
|
||||||
> Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
|
||||||
> stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
|
|
||||||
> [!WARNING]
|
> [!WARNING]
|
||||||
> **Warning**
|
> Service worker support is experimental and may change in future releases.
|
||||||
> Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
|
||||||
> stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
|
|
||||||
> [!CAUTION]
|
> [!CAUTION]
|
||||||
> **Caution**
|
> Enabling `BookPortableLinks = 'error'` will fail the build if any markdown link targets are missing.
|
||||||
> Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
|
||||||
> stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
|
|||||||
@@ -4,73 +4,62 @@ title: KaTeX
|
|||||||
|
|
||||||
# KaTeX
|
# KaTeX
|
||||||
|
|
||||||
KaTeX shortcode let you render math typesetting in markdown document. See [KaTeX](https://katex.org/)
|
Render math typesetting with [KaTeX](https://katex.org/). The library is loaded automatically on first use.
|
||||||
|
|
||||||
{{% hint info %}}
|
|
||||||
**Override KaTeX initialization config**
|
|
||||||
To override the [initialization config](https://katex.org/docs/options.html) for KaTeX,
|
|
||||||
create a `katex.json` file in your `assets` folder!
|
|
||||||
{{% /hint %}}
|
|
||||||
|
|
||||||
# Example
|
|
||||||
{{< katex />}}
|
{{< katex />}}
|
||||||
|
|
||||||
|
|
||||||
## Activation
|
## Activation
|
||||||
KaTeX is activated on the page by first use of the shortcode or render block. you can force activation with empty `{{</* katex /*/>}}` and use delimiters defined in configuration in `assets/katex.json`.
|
|
||||||
|
|
||||||
## Rendering as block
|
KaTeX is activated on the page by the first use of the shortcode or a `katex` code block. You can force activation with `{{</* katex /*/>}}`, then use delimiters anywhere on the page.
|
||||||
|
|
||||||
|
## Block Rendering
|
||||||
|
|
||||||
|
Three equivalent ways to render display math:
|
||||||
|
|
||||||
{{% columns %}}
|
{{% columns %}}
|
||||||
|
|
||||||
```latex
|
- **Shortcode**
|
||||||
{{</* katex display=true >}}
|
```tpl
|
||||||
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
|
{{</* katex display=true >}}
|
||||||
{{< /katex */>}}
|
f(x) = \int_{-\infty}^\infty
|
||||||
```
|
\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
|
||||||
|
{{< /katex */>}}
|
||||||
|
```
|
||||||
|
|
||||||
````latex
|
- **Code block**
|
||||||
```katex
|
````
|
||||||
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
|
```katex
|
||||||
```
|
f(x) = \int_{-\infty}^\infty
|
||||||
````
|
\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
|
||||||
|
```
|
||||||
|
````
|
||||||
|
|
||||||
````latex
|
- **Dollar delimiters**
|
||||||
$$
|
```
|
||||||
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
|
$$
|
||||||
$$
|
f(x) = \int_{-\infty}^\infty
|
||||||
````
|
\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
|
||||||
|
$$
|
||||||
<--->
|
```
|
||||||
|
|
||||||
{{< katex display=true >}}
|
|
||||||
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
|
|
||||||
{{< /katex >}}
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
```katex
|
|
||||||
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
$$
|
|
||||||
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
|
|
||||||
$$
|
|
||||||
|
|
||||||
{{% /columns %}}
|
{{% /columns %}}
|
||||||
|
|
||||||
## Rendering inline
|
Result:
|
||||||
When KaTeX is active on the page it is possible to write inline expressions.
|
|
||||||
|
|
||||||
| Code | Output |
|
$$
|
||||||
| -- | -- |
|
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
|
||||||
|
$$
|
||||||
|
|
||||||
|
## Inline Rendering
|
||||||
|
|
||||||
|
| Syntax | Output |
|
||||||
|
| -- | -- |
|
||||||
| `{{</* katex >}}\pi(x){{< /katex */>}}` | {{< katex >}}\pi(x){{< /katex >}} |
|
| `{{</* katex >}}\pi(x){{< /katex */>}}` | {{< katex >}}\pi(x){{< /katex >}} |
|
||||||
| `\\( \pi(x) \\)` | \\( \pi(x) \\) |
|
| `\\( \pi(x) \\)` | \\( \pi(x) \\) |
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
KaTeX configuration could be adjusted by editing `assets/katex.json` file. For example to enabled inline delimiters `$..$` put content below into the file.
|
|
||||||
|
Override KaTeX options by creating `assets/katex.json`. For example, to enable `$...$` inline delimiters
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@@ -83,3 +72,4 @@ KaTeX configuration could be adjusted by editing `assets/katex.json` file. For e
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
See [KaTeX options](https://katex.org/docs/options.html) for all available settings.
|
||||||
|
|||||||
@@ -1,186 +1,69 @@
|
|||||||
# Mermaid Chart
|
# Mermaid
|
||||||
|
|
||||||
[MermaidJS](https://mermaid-js.github.io/) is library for generating svg charts and diagrams from text.
|
Render diagrams and charts with [Mermaid](https://mermaid.js.org/). The library is loaded automatically on first use.
|
||||||
|
|
||||||
{{% hint info %}}
|
> [!TIP]
|
||||||
**Override Mermaid initialization config**
|
> Override Mermaid initialization by creating `assets/mermaid.json` in your project.
|
||||||
To override the [initialization config](https://mermaid-js.github.io/mermaid/#/Setup) for Mermaid,
|
|
||||||
create a `mermaid.json` file in your `assets` folder!
|
|
||||||
{{% /hint %}}
|
|
||||||
|
|
||||||
## Example
|
## Syntax
|
||||||
|
|
||||||
|
Use fenced code blocks (recommended) or the shortcode
|
||||||
|
|
||||||
|
````tpl
|
||||||
|
```mermaid
|
||||||
|
graph LR
|
||||||
|
A --> B
|
||||||
|
```
|
||||||
|
````
|
||||||
|
|
||||||
|
```tpl
|
||||||
|
{{</* mermaid [class="..."] */>}}
|
||||||
|
graph LR
|
||||||
|
A --> B
|
||||||
|
{{</* /mermaid */>}}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
{{% columns %}}
|
{{% columns %}}
|
||||||
- ````tpl
|
|
||||||
```mermaid
|
|
||||||
stateDiagram-v2
|
|
||||||
State1: The state with a note
|
|
||||||
note right of State1
|
|
||||||
Important information! You can write
|
|
||||||
notes.
|
|
||||||
end note
|
|
||||||
State1 --> State2
|
|
||||||
note left of State2 : This is the note to the left.
|
|
||||||
```
|
|
||||||
````
|
|
||||||
|
|
||||||
- ```mermaid
|
- ```mermaid
|
||||||
stateDiagram-v2
|
flowchart TD
|
||||||
State1: The state with a note
|
A[Content Files] --> B[Hugo Build]
|
||||||
note right of State1
|
B --> C[HTML Output]
|
||||||
Important information! You can write
|
B --> D[Search Index]
|
||||||
notes.
|
B --> E[RSS Feed]
|
||||||
end note
|
```
|
||||||
State1 --> State2
|
|
||||||
note left of State2 : This is the note to the left.
|
```mermaid
|
||||||
```
|
sequenceDiagram
|
||||||
{{% /columns %}}
|
Browser->>Hugo: Request page
|
||||||
|
Hugo->>Theme: Apply template
|
||||||
{{% columns %}}
|
Theme->>Browser: Rendered HTML
|
||||||
- ```tpl
|
Browser->>Browser: Load shortcodes
|
||||||
{{</* mermaid [class="..."] >}}
|
```
|
||||||
stateDiagram-v2
|
|
||||||
State1: The state with a note
|
- ```mermaid
|
||||||
note right of State1
|
pie title Theme Assets
|
||||||
Important information! You can write
|
"SCSS" : 8
|
||||||
notes.
|
"HTML Templates" : 30
|
||||||
end note
|
"JavaScript" : 3
|
||||||
State1 --> State2
|
"i18n Files" : 35
|
||||||
note left of State2 : This is the note to the left.
|
```
|
||||||
{{< /mermaid */>}}
|
|
||||||
|
```mermaid
|
||||||
|
gitGraph
|
||||||
|
commit id: "init"
|
||||||
|
commit id: "add theme"
|
||||||
|
branch feature
|
||||||
|
checkout feature
|
||||||
|
commit id: "add docs"
|
||||||
|
commit id: "add config"
|
||||||
|
checkout main
|
||||||
|
merge feature
|
||||||
|
commit id: "deploy"
|
||||||
```
|
```
|
||||||
|
|
||||||
- {{< mermaid >}}
|
|
||||||
stateDiagram-v2
|
|
||||||
State1: The state with a note
|
|
||||||
note right of State1
|
|
||||||
Important information! You can write
|
|
||||||
notes.
|
|
||||||
end note
|
|
||||||
State1 --> State2
|
|
||||||
note left of State2 : This is the note to the left.
|
|
||||||
{{< /mermaid >}}
|
|
||||||
{{% /columns %}}
|
{{% /columns %}}
|
||||||
|
|
||||||
## Diagrams
|
Explore more diagram types on the [Mermaid documentation](https://mermaid.js.org/syntax/flowchart.html).
|
||||||
Explore more diagrams and syntax on Mermaid [documentation page](https://mermaid.js.org/syntax/flowchart.html).
|
|
||||||
|
|
||||||
{{% columns %}}
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
stateDiagram-v2
|
|
||||||
State1: The state with a note
|
|
||||||
note right of State1
|
|
||||||
Important information! You can write
|
|
||||||
notes.
|
|
||||||
end note
|
|
||||||
State1 --> State2
|
|
||||||
note left of State2 : This is the note to the left.
|
|
||||||
```
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
sequenceDiagram
|
|
||||||
Alice->>John: Hello John, how are you?
|
|
||||||
John-->>Alice: Great!
|
|
||||||
Alice-)John: See you later!
|
|
||||||
```
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
---
|
|
||||||
title: Animal example
|
|
||||||
---
|
|
||||||
classDiagram
|
|
||||||
note "From Duck till Zebra"
|
|
||||||
Animal <|-- Duck
|
|
||||||
note for Duck "can fly\ncan swim\ncan dive\ncan help in debugging"
|
|
||||||
Animal <|-- Fish
|
|
||||||
Animal <|-- Zebra
|
|
||||||
Animal : +int age
|
|
||||||
Animal : +String gender
|
|
||||||
Animal: +isMammal()
|
|
||||||
Animal: +mate()
|
|
||||||
class Duck{
|
|
||||||
+String beakColor
|
|
||||||
+swim()
|
|
||||||
+quack()
|
|
||||||
}
|
|
||||||
class Fish{
|
|
||||||
-int sizeInFeet
|
|
||||||
-canEat()
|
|
||||||
}
|
|
||||||
class Zebra{
|
|
||||||
+bool is_wild
|
|
||||||
+run()
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
---
|
|
||||||
title: Simple sample
|
|
||||||
---
|
|
||||||
stateDiagram-v2
|
|
||||||
[*] --> Still
|
|
||||||
Still --> [*]
|
|
||||||
|
|
||||||
Still --> Moving
|
|
||||||
Moving --> Still
|
|
||||||
Moving --> Crash
|
|
||||||
Crash --> [*]
|
|
||||||
```
|
|
||||||
|
|
||||||
<--->
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
---
|
|
||||||
title: Example Git diagram
|
|
||||||
---
|
|
||||||
gitGraph
|
|
||||||
commit
|
|
||||||
commit
|
|
||||||
branch develop
|
|
||||||
checkout develop
|
|
||||||
commit
|
|
||||||
commit
|
|
||||||
checkout main
|
|
||||||
merge develop
|
|
||||||
commit
|
|
||||||
commit
|
|
||||||
```
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
gantt
|
|
||||||
title A Gantt Diagram
|
|
||||||
dateFormat YYYY-MM-DD
|
|
||||||
section Section
|
|
||||||
A task :a1, 2014-01-01, 30d
|
|
||||||
Another task :after a1, 20d
|
|
||||||
section Another
|
|
||||||
Task in Another :2014-01-12, 12d
|
|
||||||
another task :24d
|
|
||||||
```
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
pie title Pets adopted by volunteers
|
|
||||||
"Dogs" : 386
|
|
||||||
"Cats" : 85
|
|
||||||
"Rats" : 15
|
|
||||||
```
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
quadrantChart
|
|
||||||
title Reach and engagement of campaigns
|
|
||||||
x-axis Low Reach --> High Reach
|
|
||||||
y-axis Low Engagement --> High Engagement
|
|
||||||
quadrant-1 We should expand
|
|
||||||
quadrant-2 Need to promote
|
|
||||||
quadrant-3 Re-evaluate
|
|
||||||
quadrant-4 May be improved
|
|
||||||
Campaign A: [0.3, 0.6]
|
|
||||||
Campaign B: [0.45, 0.23]
|
|
||||||
Campaign C: [0.57, 0.69]
|
|
||||||
Campaign D: [0.78, 0.34]
|
|
||||||
Campaign E: [0.40, 0.34]
|
|
||||||
Campaign F: [0.35, 0.78]
|
|
||||||
```
|
|
||||||
|
|
||||||
{{% /columns %}}
|
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
---
|
|
||||||
bookCollapseSection: true
|
|
||||||
bookHidden: true
|
|
||||||
---
|
|
||||||
|
|
||||||
# Section
|
|
||||||
|
|
||||||
Section renders pages in section as definition list, using title and description. Optional param `summary` can be used to show or hide page summary
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
```tpl
|
|
||||||
{{</* section [summary] */>}}
|
|
||||||
```
|
|
||||||
|
|
||||||
{{<section summary>}}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
# First page
|
|
||||||
|
|
||||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
||||||
|
|
||||||
<!--more-->
|
|
||||||
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
# Second Page
|
|
||||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
||||||
|
|
||||||
<!--more-->
|
|
||||||
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
|
||||||
|
|
||||||
@@ -1,35 +1,31 @@
|
|||||||
# Steps
|
# Steps
|
||||||
|
|
||||||
Steps shortcode styles numbered list as series of points for better content organization.
|
Render an ordered list as a series of numbered steps with visual connectors.
|
||||||
|
|
||||||
|
## Syntax
|
||||||
|
|
||||||
```tpl
|
```tpl
|
||||||
{{%/* steps */%}}
|
{{%/* steps */%}}
|
||||||
1. ## Suspendisse sed congue orci.
|
1. ## Step Title
|
||||||
...
|
Step description...
|
||||||
|
|
||||||
2. ## Maecenas scelerisque sem.
|
2. ## Step Title
|
||||||
...
|
Step description...
|
||||||
|
|
||||||
3. ## Etiam risus purus.
|
|
||||||
...
|
|
||||||
|
|
||||||
4. ## Curabitur sed lacinia velit.
|
|
||||||
...
|
|
||||||
{{%/* /steps */%}}
|
{{%/* /steps */%}}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
{{% steps %}}
|
{{% steps %}}
|
||||||
1. ## Suspendisse sed congue orci.
|
1. ## Create your site
|
||||||
Suspendisse sed congue orci, eu congue metus. Nullam feugiat urna massa, et fringilla metus consectetur molestie. Curabitur pellentesque sodales ipsum, sed efficitur libero euismod ac. Donec sit amet erat nunc. Suspendisse porta nisl velit, quis auctor massa commodo nec. Donec sollicitudin tellus sit amet massa condimentum luctus. Etiam molestie at ante et convallis.
|
Run `hugo new site my-docs` to scaffold a new Hugo project.
|
||||||
|
|
||||||
2. ## Maecenas scelerisque sem.
|
2. ## Add the theme
|
||||||
Maecenas scelerisque sem a tellus dignissim, in sodales neque varius. Integer quis ex quis sem posuere consequat. Morbi interdum ex et mollis maximus. Proin sed quam nisl. Donec tempus non risus vel auctor. Ut ultricies vitae urna in laoreet. Phasellus cursus nunc sit amet sodales euismod. Suspendisse potenti.
|
Clone or add hugo-book as a submodule in your `themes/` directory.
|
||||||
|
|
||||||
3. ## Etiam risus purus.
|
3. ## Write content
|
||||||
Etiam risus purus, suscipit a orci quis, mollis mollis ante. Vestibulum congue nisl malesuada tortor egestas, a lobortis tellus dictum. Nam nec ultrices justo. Donec malesuada dignissim posuere.
|
Add markdown files under `content/docs/`. Each file becomes a page in the sidebar menu.
|
||||||
|
|
||||||
4. ## Curabitur sed lacinia velit.
|
4. ## Deploy
|
||||||
Curabitur sed lacinia velit. Nullam sed ante non quam lobortis hendrerit. Phasellus elementum, erat sit amet imperdiet pulvinar, odio massa lobortis ipsum, in tincidunt metus dolor vel ligula.
|
Run `hugo` to build the site. The output is in the `public/` directory, ready for any static hosting.
|
||||||
{{% /steps %}}
|
{{% /steps %}}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
# Tabs
|
# Tabs
|
||||||
|
|
||||||
Tabs let you organize content by context, for example installation instructions for each supported platform.
|
Organize content by context, for example installation instructions for each supported platform.
|
||||||
|
|
||||||
|
## Syntax
|
||||||
|
|
||||||
```tpl
|
```tpl
|
||||||
{{</* tabs */>}}
|
{{</* tabs */>}}
|
||||||
{{%/* tab "MacOS" */%}} # MacOS Content {{%/* /tab */%}}
|
{{%/* tab "First" */%}} Markdown content {{%/* /tab */%}}
|
||||||
{{%/* tab "Linux" */%}} # Linux Content {{%/* /tab */%}}
|
{{%/* tab "Second" */%}} Markdown content {{%/* /tab */%}}
|
||||||
{{%/* tab "Windows" */%}} # Windows Content {{%/* /tab */%}}
|
|
||||||
{{</* /tabs */>}}
|
{{</* /tabs */>}}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -14,37 +15,22 @@ Tabs let you organize content by context, for example installation instructions
|
|||||||
|
|
||||||
{{< tabs >}}
|
{{< tabs >}}
|
||||||
|
|
||||||
{{% tab "MacOS" %}}
|
{{% tab "macOS" %}}
|
||||||
# MacOS
|
```shell
|
||||||
|
brew install hugo
|
||||||
This is tab **MacOS** content.
|
```
|
||||||
|
|
||||||
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
|
||||||
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
|
|
||||||
Miseratus fonte Ditis conubia.
|
|
||||||
{{% /tab %}}
|
{{% /tab %}}
|
||||||
|
|
||||||
{{% tab "Linux" %}}
|
{{% tab "Linux" %}}
|
||||||
# Linux
|
```shell
|
||||||
|
sudo snap install hugo
|
||||||
This is tab **Linux** content.
|
```
|
||||||
|
|
||||||
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
|
||||||
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
|
|
||||||
Miseratus fonte Ditis conubia.
|
|
||||||
{{% /tab %}}
|
{{% /tab %}}
|
||||||
|
|
||||||
{{% tab "Windows" %}}
|
{{% tab "Windows" %}}
|
||||||
# Windows
|
```shell
|
||||||
|
choco install hugo-extended
|
||||||
This is tab **Windows** content.
|
```
|
||||||
|
|
||||||
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
|
||||||
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
|
|
||||||
Miseratus fonte Ditis conubia.
|
|
||||||
{{% /tab %}}
|
{{% /tab %}}
|
||||||
|
|
||||||
{{< /tabs >}}
|
{{< /tabs >}}
|
||||||
|
|||||||
@@ -1,106 +0,0 @@
|
|||||||
---
|
|
||||||
bookHidden: true
|
|
||||||
---
|
|
||||||
|
|
||||||
{{% columns %}}
|
|
||||||
- ## Asciinema
|
|
||||||
{{< asciinema
|
|
||||||
cast="asciinema-627097.cast"
|
|
||||||
loop=true
|
|
||||||
autoplay=true
|
|
||||||
speed=2 >}}
|
|
||||||
|
|
||||||
- ## Badge
|
|
||||||
{{<badge title="Title" value="Value">}}
|
|
||||||
|
|
||||||
- ## Button
|
|
||||||
{{<button href="/">}}A Button{{</button>}}
|
|
||||||
|
|
||||||
- ## Card
|
|
||||||
{{<card href="/docs/shortcodes/experimental/cards">}}
|
|
||||||
**Markdown**
|
|
||||||
Suspendisse sed congue orci, eu congue metus. Nullam feugiat urna massa.
|
|
||||||
{{</card>}}
|
|
||||||
|
|
||||||
- ## Details
|
|
||||||
{{<details "Title" open>}}
|
|
||||||
## Markdown content
|
|
||||||
Lorem markdownum insigne...
|
|
||||||
{{</details>}}
|
|
||||||
|
|
||||||
- ## Hint
|
|
||||||
{{<hint danger>}}
|
|
||||||
**Markdown content**
|
|
||||||
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
|
||||||
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
{{</hint>}}
|
|
||||||
|
|
||||||
- ## Image
|
|
||||||
{{<image src="placeholder.svg" alt="A placeholder" title="A placeholder" loading="lazy">}}
|
|
||||||
|
|
||||||
- ## KaTeX
|
|
||||||
{{<katex display="true">}}
|
|
||||||
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
|
|
||||||
{{</katex>}}
|
|
||||||
|
|
||||||
- ## Mermaid
|
|
||||||
{{<mermaid>}}
|
|
||||||
stateDiagram-v2
|
|
||||||
State1: The state with a note
|
|
||||||
note right of State1
|
|
||||||
Important information! You can write
|
|
||||||
notes.
|
|
||||||
end note
|
|
||||||
State1 --> State2
|
|
||||||
note left of State2 : This is the note to the left.
|
|
||||||
{{</mermaid>}}
|
|
||||||
|
|
||||||
- ## Steps
|
|
||||||
{{<steps>}}
|
|
||||||
1. ## Suspendisse sed congue orci.
|
|
||||||
Suspendisse sed congue orci, eu congue metus.
|
|
||||||
|
|
||||||
2. ## Maecenas scelerisque sem.
|
|
||||||
Maecenas scelerisque sem a tellus dignissim.
|
|
||||||
|
|
||||||
3. ## Etiam risus purus.
|
|
||||||
Etiam risus purus, suscipit a orci quis.
|
|
||||||
|
|
||||||
4. ## Curabitur sed lacinia velit.
|
|
||||||
Curabitur sed lacinia velit. Nullam sed ante non quam.
|
|
||||||
{{</steps>}}
|
|
||||||
|
|
||||||
- ## Tabs
|
|
||||||
{{<tabs>}}
|
|
||||||
{{<tab "MacOS">}}
|
|
||||||
# MacOS
|
|
||||||
|
|
||||||
This is tab **MacOS** content.
|
|
||||||
|
|
||||||
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
|
||||||
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
|
|
||||||
Miseratus fonte Ditis conubia.
|
|
||||||
{{</tab>}}
|
|
||||||
{{<tab "Linux">}}
|
|
||||||
# Linux
|
|
||||||
|
|
||||||
This is tab **Linux** content.
|
|
||||||
|
|
||||||
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
|
||||||
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
|
|
||||||
Miseratus fonte Ditis conubia.
|
|
||||||
{{</tab>}}
|
|
||||||
{{<tab "Windows">}}
|
|
||||||
# Windows
|
|
||||||
|
|
||||||
This is tab **Windows** content.
|
|
||||||
|
|
||||||
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
|
|
||||||
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
|
|
||||||
protulit, sed sed aere valvis inhaesuro Pallas animam: qui _quid_, ignes.
|
|
||||||
Miseratus fonte Ditis conubia.
|
|
||||||
{{</tab>}}
|
|
||||||
{{</tabs>}}
|
|
||||||
{{% /columns %}}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
title: "Example Blog Post"
|
||||||
|
date: 2025-01-15
|
||||||
|
tags: ["hugo", "theme"]
|
||||||
|
categories: ["Example"]
|
||||||
|
---
|
||||||
|
|
||||||
|
This is an example blog post demonstrating the Hugo Book blog layout.
|
||||||
|
|
||||||
|
## What This Demonstrates
|
||||||
|
|
||||||
|
Blog posts in Hugo Book support standard Hugo content features:
|
||||||
|
|
||||||
|
- **Date display**: configured via `BookDateFormat`
|
||||||
|
- **Tags and categories**: displayed as metadata
|
||||||
|
- **Pagination**: automatic when multiple posts exist
|
||||||
|
- **Prev/next navigation**: links between posts in the section
|
||||||
|
|
||||||
|
## Adding Your Own Posts
|
||||||
|
|
||||||
|
Create markdown files under `content/posts/`:
|
||||||
|
|
||||||
|
```
|
||||||
|
content/
|
||||||
|
└── posts/
|
||||||
|
├── _index.md
|
||||||
|
├── first-post.md
|
||||||
|
└── second-post.md
|
||||||
|
```
|
||||||
|
|
||||||
|
Each post needs at minimum a `title` and `date` in frontmatter. See [Blog](/docs/content/blog/) for full documentation.
|
||||||
@@ -1,344 +0,0 @@
|
|||||||
+++
|
|
||||||
title = "(Hu)go Template Primer"
|
|
||||||
description = ""
|
|
||||||
tags = [
|
|
||||||
"go",
|
|
||||||
"golang",
|
|
||||||
"templates",
|
|
||||||
"themes",
|
|
||||||
"development",
|
|
||||||
]
|
|
||||||
date = "2014-04-02"
|
|
||||||
categories = [
|
|
||||||
"Development",
|
|
||||||
"golang",
|
|
||||||
]
|
|
||||||
menu = "main"
|
|
||||||
+++
|
|
||||||
|
|
||||||
Hugo uses the excellent [Go][] [html/template][gohtmltemplate] library for
|
|
||||||
its template engine. It is an extremely lightweight engine that provides a very
|
|
||||||
small amount of logic. In our experience that it is just the right amount of
|
|
||||||
logic to be able to create a good static website. If you have used other
|
|
||||||
template systems from different languages or frameworks you will find a lot of
|
|
||||||
similarities in Go templates.
|
|
||||||
|
|
||||||
This document is a brief primer on using Go templates. The [Go docs][gohtmltemplate]
|
|
||||||
provide more details.
|
|
||||||
|
|
||||||
## Introduction to Go Templates
|
|
||||||
|
|
||||||
Go templates provide an extremely simple template language. It adheres to the
|
|
||||||
belief that only the most basic of logic belongs in the template or view layer.
|
|
||||||
One consequence of this simplicity is that Go templates parse very quickly.
|
|
||||||
|
|
||||||
A unique characteristic of Go templates is they are content aware. Variables and
|
|
||||||
content will be sanitized depending on the context of where they are used. More
|
|
||||||
details can be found in the [Go docs][gohtmltemplate].
|
|
||||||
|
|
||||||
## Basic Syntax
|
|
||||||
|
|
||||||
Golang templates are HTML files with the addition of variables and
|
|
||||||
functions.
|
|
||||||
|
|
||||||
**Go variables and functions are accessible within {{ }}**
|
|
||||||
|
|
||||||
Accessing a predefined variable "foo":
|
|
||||||
|
|
||||||
{{ foo }}
|
|
||||||
|
|
||||||
**Parameters are separated using spaces**
|
|
||||||
|
|
||||||
Calling the add function with input of 1, 2:
|
|
||||||
|
|
||||||
{{ add 1 2 }}
|
|
||||||
|
|
||||||
**Methods and fields are accessed via dot notation**
|
|
||||||
|
|
||||||
Accessing the Page Parameter "bar"
|
|
||||||
|
|
||||||
{{ .Params.bar }}
|
|
||||||
|
|
||||||
**Parentheses can be used to group items together**
|
|
||||||
|
|
||||||
{{ if or (isset .Params "alt") (isset .Params "caption") }} Caption {{ end }}
|
|
||||||
|
|
||||||
|
|
||||||
## Variables
|
|
||||||
|
|
||||||
Each Go template has a struct (object) made available to it. In hugo each
|
|
||||||
template is passed either a page or a node struct depending on which type of
|
|
||||||
page you are rendering. More details are available on the
|
|
||||||
[variables](/layout/variables) page.
|
|
||||||
|
|
||||||
A variable is accessed by referencing the variable name.
|
|
||||||
|
|
||||||
<title>{{ .Title }}</title>
|
|
||||||
|
|
||||||
Variables can also be defined and referenced.
|
|
||||||
|
|
||||||
{{ $address := "123 Main St."}}
|
|
||||||
{{ $address }}
|
|
||||||
|
|
||||||
|
|
||||||
## Functions
|
|
||||||
|
|
||||||
Go template ship with a few functions which provide basic functionality. The Go
|
|
||||||
template system also provides a mechanism for applications to extend the
|
|
||||||
available functions with their own. [Hugo template
|
|
||||||
functions](/layout/functions) provide some additional functionality we believe
|
|
||||||
are useful for building websites. Functions are called by using their name
|
|
||||||
followed by the required parameters separated by spaces. Template
|
|
||||||
functions cannot be added without recompiling hugo.
|
|
||||||
|
|
||||||
**Example:**
|
|
||||||
|
|
||||||
{{ add 1 2 }}
|
|
||||||
|
|
||||||
## Includes
|
|
||||||
|
|
||||||
When including another template you will pass to it the data it will be
|
|
||||||
able to access. To pass along the current context please remember to
|
|
||||||
include a trailing dot. The templates location will always be starting at
|
|
||||||
the /layout/ directory within Hugo.
|
|
||||||
|
|
||||||
**Example:**
|
|
||||||
|
|
||||||
{{ template "chrome/header.html" . }}
|
|
||||||
|
|
||||||
|
|
||||||
## Logic
|
|
||||||
|
|
||||||
Go templates provide the most basic iteration and conditional logic.
|
|
||||||
|
|
||||||
### Iteration
|
|
||||||
|
|
||||||
Just like in Go, the Go templates make heavy use of range to iterate over
|
|
||||||
a map, array or slice. The following are different examples of how to use
|
|
||||||
range.
|
|
||||||
|
|
||||||
**Example 1: Using Context**
|
|
||||||
|
|
||||||
{{ range array }}
|
|
||||||
{{ . }}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
**Example 2: Declaring value variable name**
|
|
||||||
|
|
||||||
{{range $element := array}}
|
|
||||||
{{ $element }}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
**Example 2: Declaring key and value variable name**
|
|
||||||
|
|
||||||
{{range $index, $element := array}}
|
|
||||||
{{ $index }}
|
|
||||||
{{ $element }}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
### Conditionals
|
|
||||||
|
|
||||||
If, else, with, or, & and provide the framework for handling conditional
|
|
||||||
logic in Go Templates. Like range, each statement is closed with `end`.
|
|
||||||
|
|
||||||
|
|
||||||
Go Templates treat the following values as false:
|
|
||||||
|
|
||||||
* false
|
|
||||||
* 0
|
|
||||||
* any array, slice, map, or string of length zero
|
|
||||||
|
|
||||||
**Example 1: If**
|
|
||||||
|
|
||||||
{{ if isset .Params "title" }}<h4>{{ index .Params "title" }}</h4>{{ end }}
|
|
||||||
|
|
||||||
**Example 2: If -> Else**
|
|
||||||
|
|
||||||
{{ if isset .Params "alt" }}
|
|
||||||
{{ index .Params "alt" }}
|
|
||||||
{{else}}
|
|
||||||
{{ index .Params "caption" }}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
**Example 3: And & Or**
|
|
||||||
|
|
||||||
{{ if and (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")}}
|
|
||||||
|
|
||||||
**Example 4: With**
|
|
||||||
|
|
||||||
An alternative way of writing "if" and then referencing the same value
|
|
||||||
is to use "with" instead. With rebinds the context `.` within its scope,
|
|
||||||
and skips the block if the variable is absent.
|
|
||||||
|
|
||||||
The first example above could be simplified as:
|
|
||||||
|
|
||||||
{{ with .Params.title }}<h4>{{ . }}</h4>{{ end }}
|
|
||||||
|
|
||||||
**Example 5: If -> Else If**
|
|
||||||
|
|
||||||
{{ if isset .Params "alt" }}
|
|
||||||
{{ index .Params "alt" }}
|
|
||||||
{{ else if isset .Params "caption" }}
|
|
||||||
{{ index .Params "caption" }}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
## Pipes
|
|
||||||
|
|
||||||
One of the most powerful components of Go templates is the ability to
|
|
||||||
stack actions one after another. This is done by using pipes. Borrowed
|
|
||||||
from unix pipes, the concept is simple, each pipeline's output becomes the
|
|
||||||
input of the following pipe.
|
|
||||||
|
|
||||||
Because of the very simple syntax of Go templates, the pipe is essential
|
|
||||||
to being able to chain together function calls. One limitation of the
|
|
||||||
pipes is that they only can work with a single value and that value
|
|
||||||
becomes the last parameter of the next pipeline.
|
|
||||||
|
|
||||||
A few simple examples should help convey how to use the pipe.
|
|
||||||
|
|
||||||
**Example 1 :**
|
|
||||||
|
|
||||||
{{ if eq 1 1 }} Same {{ end }}
|
|
||||||
|
|
||||||
is the same as
|
|
||||||
|
|
||||||
{{ eq 1 1 | if }} Same {{ end }}
|
|
||||||
|
|
||||||
It does look odd to place the if at the end, but it does provide a good
|
|
||||||
illustration of how to use the pipes.
|
|
||||||
|
|
||||||
**Example 2 :**
|
|
||||||
|
|
||||||
{{ index .Params "disqus_url" | html }}
|
|
||||||
|
|
||||||
Access the page parameter called "disqus_url" and escape the HTML.
|
|
||||||
|
|
||||||
**Example 3 :**
|
|
||||||
|
|
||||||
{{ if or (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")}}
|
|
||||||
Stuff Here
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
Could be rewritten as
|
|
||||||
|
|
||||||
{{ isset .Params "caption" | or isset .Params "title" | or isset .Params "attr" | if }}
|
|
||||||
Stuff Here
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
|
|
||||||
## Context (aka. the dot)
|
|
||||||
|
|
||||||
The most easily overlooked concept to understand about Go templates is that {{ . }}
|
|
||||||
always refers to the current context. In the top level of your template this
|
|
||||||
will be the data set made available to it. Inside of a iteration it will have
|
|
||||||
the value of the current item. When inside of a loop the context has changed. .
|
|
||||||
will no longer refer to the data available to the entire page. If you need to
|
|
||||||
access this from within the loop you will likely want to set it to a variable
|
|
||||||
instead of depending on the context.
|
|
||||||
|
|
||||||
**Example:**
|
|
||||||
|
|
||||||
{{ $title := .Site.Title }}
|
|
||||||
{{ range .Params.tags }}
|
|
||||||
<li> <a href="{{ $baseurl }}/tags/{{ . | urlize }}">{{ . }}</a> - {{ $title }} </li>
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
Notice how once we have entered the loop the value of {{ . }} has changed. We
|
|
||||||
have defined a variable outside of the loop so we have access to it from within
|
|
||||||
the loop.
|
|
||||||
|
|
||||||
# Hugo Parameters
|
|
||||||
|
|
||||||
Hugo provides the option of passing values to the template language
|
|
||||||
through the site configuration (for sitewide values), or through the meta
|
|
||||||
data of each specific piece of content. You can define any values of any
|
|
||||||
type (supported by your front matter/config format) and use them however
|
|
||||||
you want to inside of your templates.
|
|
||||||
|
|
||||||
|
|
||||||
## Using Content (page) Parameters
|
|
||||||
|
|
||||||
In each piece of content you can provide variables to be used by the
|
|
||||||
templates. This happens in the [front matter](/content/front-matter).
|
|
||||||
|
|
||||||
An example of this is used in this documentation site. Most of the pages
|
|
||||||
benefit from having the table of contents provided. Sometimes the TOC just
|
|
||||||
doesn't make a lot of sense. We've defined a variable in our front matter
|
|
||||||
of some pages to turn off the TOC from being displayed.
|
|
||||||
|
|
||||||
Here is the example front matter:
|
|
||||||
|
|
||||||
```
|
|
||||||
---
|
|
||||||
title: "Permalinks"
|
|
||||||
date: "2013-11-18"
|
|
||||||
aliases:
|
|
||||||
- "/doc/permalinks/"
|
|
||||||
groups: ["extras"]
|
|
||||||
groups_weight: 30
|
|
||||||
notoc: true
|
|
||||||
---
|
|
||||||
```
|
|
||||||
|
|
||||||
Here is the corresponding code inside of the template:
|
|
||||||
|
|
||||||
{{ if not .Params.notoc }}
|
|
||||||
<div id="toc" class="well col-md-4 col-sm-6">
|
|
||||||
{{ .TableOfContents }}
|
|
||||||
</div>
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Using Site (config) Parameters
|
|
||||||
In your top-level configuration file (eg, `config.yaml`) you can define site
|
|
||||||
parameters, which are values which will be available to you in chrome.
|
|
||||||
|
|
||||||
For instance, you might declare:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
params:
|
|
||||||
CopyrightHTML: "Copyright © 2013 John Doe. All Rights Reserved."
|
|
||||||
TwitterUser: "spf13"
|
|
||||||
SidebarRecentLimit: 5
|
|
||||||
```
|
|
||||||
|
|
||||||
Within a footer layout, you might then declare a `<footer>` which is only
|
|
||||||
provided if the `CopyrightHTML` parameter is provided, and if it is given,
|
|
||||||
you would declare it to be HTML-safe, so that the HTML entity is not escaped
|
|
||||||
again. This would let you easily update just your top-level config file each
|
|
||||||
January 1st, instead of hunting through your templates.
|
|
||||||
|
|
||||||
```
|
|
||||||
{{if .Site.Params.CopyrightHTML}}<footer>
|
|
||||||
<div class="text-center">{{.Site.Params.CopyrightHTML | safeHtml}}</div>
|
|
||||||
</footer>{{end}}
|
|
||||||
```
|
|
||||||
|
|
||||||
An alternative way of writing the "if" and then referencing the same value
|
|
||||||
is to use "with" instead. With rebinds the context `.` within its scope,
|
|
||||||
and skips the block if the variable is absent:
|
|
||||||
|
|
||||||
```
|
|
||||||
{{with .Site.Params.TwitterUser}}<span class="twitter">
|
|
||||||
<a href="https://twitter.com/{{.}}" rel="author">
|
|
||||||
<img src="/images/twitter.png" width="48" height="48" title="Twitter: {{.}}"
|
|
||||||
alt="Twitter"></a>
|
|
||||||
</span>{{end}}
|
|
||||||
```
|
|
||||||
|
|
||||||
Finally, if you want to pull "magic constants" out of your layouts, you can do
|
|
||||||
so, such as in this example:
|
|
||||||
|
|
||||||
```
|
|
||||||
<nav class="recent">
|
|
||||||
<h1>Recent Posts</h1>
|
|
||||||
<ul>{{range first .Site.Params.SidebarRecentLimit .Site.Recent}}
|
|
||||||
<li><a href="{{.RelPermalink}}">{{.Title}}</a></li>
|
|
||||||
{{end}}</ul>
|
|
||||||
</nav>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
[go]: https://golang.org/
|
|
||||||
[gohtmltemplate]: https://golang.org/pkg/html/template/
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
+++
|
|
||||||
title = "Getting Started with Hugo"
|
|
||||||
description = ""
|
|
||||||
tags = [
|
|
||||||
"go",
|
|
||||||
"golang",
|
|
||||||
"hugo",
|
|
||||||
"development",
|
|
||||||
]
|
|
||||||
date = "2014-04-02"
|
|
||||||
categories = [
|
|
||||||
"Development",
|
|
||||||
"golang",
|
|
||||||
]
|
|
||||||
menu = "main"
|
|
||||||
+++
|
|
||||||
|
|
||||||
## Step 1. Install Hugo
|
|
||||||
|
|
||||||
Go to [Hugo releases](https://github.com/spf13/hugo/releases) and download the
|
|
||||||
appropriate version for your OS and architecture.
|
|
||||||
|
|
||||||
Save it somewhere specific as we will be using it in the next step.
|
|
||||||
|
|
||||||
More complete instructions are available at [Install Hugo](https://gohugo.io/getting-started/installing/)
|
|
||||||
|
|
||||||
## Step 2. Build the Docs
|
|
||||||
|
|
||||||
Hugo has its own example site which happens to also be the documentation site
|
|
||||||
you are reading right now.
|
|
||||||
|
|
||||||
Follow the following steps:
|
|
||||||
|
|
||||||
1. Clone the [Hugo repository](http://github.com/spf13/hugo)
|
|
||||||
2. Go into the repo
|
|
||||||
3. Run hugo in server mode and build the docs
|
|
||||||
4. Open your browser to http://localhost:1313
|
|
||||||
|
|
||||||
Corresponding pseudo commands:
|
|
||||||
|
|
||||||
git clone https://github.com/spf13/hugo
|
|
||||||
cd hugo
|
|
||||||
/path/to/where/you/installed/hugo server --source=./docs
|
|
||||||
> 29 pages created
|
|
||||||
> 0 tags index created
|
|
||||||
> in 27 ms
|
|
||||||
> Web Server is available at http://localhost:1313
|
|
||||||
> Press ctrl+c to stop
|
|
||||||
|
|
||||||
Once you've gotten here, follow along the rest of this page on your local build.
|
|
||||||
|
|
||||||
## Step 3. Change the docs site
|
|
||||||
|
|
||||||
Stop the Hugo process by hitting Ctrl+C.
|
|
||||||
|
|
||||||
Now we are going to run hugo again, but this time with hugo in watch mode.
|
|
||||||
|
|
||||||
/path/to/hugo/from/step/1/hugo server --source=./docs --watch
|
|
||||||
> 29 pages created
|
|
||||||
> 0 tags index created
|
|
||||||
> in 27 ms
|
|
||||||
> Web Server is available at http://localhost:1313
|
|
||||||
> Watching for changes in /Users/spf13/Code/hugo/docs/content
|
|
||||||
> Press ctrl+c to stop
|
|
||||||
|
|
||||||
|
|
||||||
Open your [favorite editor](http://vim.spf13.com) and change one of the source
|
|
||||||
content pages. How about changing this very file to *fix the typo*. How about changing this very file to *fix the typo*.
|
|
||||||
|
|
||||||
Content files are found in `docs/content/`. Unless otherwise specified, files
|
|
||||||
are located at the same relative location as the url, in our case
|
|
||||||
`docs/content/overview/quickstart.md`.
|
|
||||||
|
|
||||||
Change and save this file.. Notice what happened in your terminal.
|
|
||||||
|
|
||||||
> Change detected, rebuilding site
|
|
||||||
|
|
||||||
> 29 pages created
|
|
||||||
> 0 tags index created
|
|
||||||
> in 26 ms
|
|
||||||
|
|
||||||
Refresh the browser and observe that the typo is now fixed.
|
|
||||||
|
|
||||||
Notice how quick that was. Try to refresh the site before it's finished building. I double dare you.
|
|
||||||
Having nearly instant feedback enables you to have your creativity flow without waiting for long builds.
|
|
||||||
|
|
||||||
## Step 4. Have fun
|
|
||||||
|
|
||||||
The best way to learn something is to play with it.
|
|
||||||
@@ -1,156 +0,0 @@
|
|||||||
---
|
|
||||||
date: 2014-03-10
|
|
||||||
linktitle: Migrating from Jekyll
|
|
||||||
menu:
|
|
||||||
main:
|
|
||||||
parent: tutorials
|
|
||||||
prev: /tutorials/mathjax
|
|
||||||
title: Migrate to Hugo from Jekyll
|
|
||||||
weight: 10
|
|
||||||
---
|
|
||||||
|
|
||||||
## Move static content to `static`
|
|
||||||
Jekyll has a rule that any directory not starting with `_` will be copied as-is to the `_site` output. Hugo keeps all static content under `static`. You should therefore move it all there.
|
|
||||||
With Jekyll, something that looked like
|
|
||||||
|
|
||||||
▾ <root>/
|
|
||||||
▾ images/
|
|
||||||
logo.png
|
|
||||||
|
|
||||||
should become
|
|
||||||
|
|
||||||
▾ <root>/
|
|
||||||
▾ static/
|
|
||||||
▾ images/
|
|
||||||
logo.png
|
|
||||||
|
|
||||||
Additionally, you'll want any files that should reside at the root (such as `CNAME`) to be moved to `static`.
|
|
||||||
|
|
||||||
## Create your Hugo configuration file
|
|
||||||
Hugo can read your configuration as JSON, YAML or TOML. Hugo supports parameters custom configuration too. Refer to the [Hugo configuration documentation](/overview/configuration/) for details.
|
|
||||||
|
|
||||||
## Set your configuration publish folder to `_site`
|
|
||||||
The default is for Jekyll to publish to `_site` and for Hugo to publish to `public`. If, like me, you have [`_site` mapped to a git submodule on the `gh-pages` branch](http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.html), you'll want to do one of two alternatives:
|
|
||||||
|
|
||||||
1. Change your submodule to point to map `gh-pages` to public instead of `_site` (recommended).
|
|
||||||
|
|
||||||
git submodule deinit _site
|
|
||||||
git rm _site
|
|
||||||
git submodule add -b gh-pages git@github.com:your-username/your-repo.git public
|
|
||||||
|
|
||||||
2. Or, change the Hugo configuration to use `_site` instead of `public`.
|
|
||||||
|
|
||||||
{
|
|
||||||
..
|
|
||||||
"publishdir": "_site",
|
|
||||||
..
|
|
||||||
}
|
|
||||||
|
|
||||||
## Convert Jekyll templates to Hugo templates
|
|
||||||
That's the bulk of the work right here. The documentation is your friend. You should refer to [Jekyll's template documentation](http://jekyllrb.com/docs/templates/) if you need to refresh your memory on how you built your blog and [Hugo's template](/layout/templates/) to learn Hugo's way.
|
|
||||||
|
|
||||||
As a single reference data point, converting my templates for [heyitsalex.net](http://heyitsalex.net/) took me no more than a few hours.
|
|
||||||
|
|
||||||
## Convert Jekyll plugins to Hugo shortcodes
|
|
||||||
Jekyll has [plugins](http://jekyllrb.com/docs/plugins/); Hugo has [shortcodes](/doc/shortcodes/). It's fairly trivial to do a port.
|
|
||||||
|
|
||||||
### Implementation
|
|
||||||
As an example, I was using a custom [`image_tag`](https://github.com/alexandre-normand/alexandre-normand/blob/74bb12036a71334fdb7dba84e073382fc06908ec/_plugins/image_tag.rb) plugin to generate figures with caption when running Jekyll. As I read about shortcodes, I found Hugo had a nice built-in shortcode that does exactly the same thing.
|
|
||||||
|
|
||||||
Jekyll's plugin:
|
|
||||||
|
|
||||||
module Jekyll
|
|
||||||
class ImageTag < Liquid::Tag
|
|
||||||
@url = nil
|
|
||||||
@caption = nil
|
|
||||||
@class = nil
|
|
||||||
@link = nil
|
|
||||||
// Patterns
|
|
||||||
IMAGE_URL_WITH_CLASS_AND_CAPTION =
|
|
||||||
IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK = /(\w+)(\s+)((https?:\/\/|\/)(\S+))(\s+)"(.*?)"(\s+)->((https?:\/\/|\/)(\S+))(\s*)/i
|
|
||||||
IMAGE_URL_WITH_CAPTION = /((https?:\/\/|\/)(\S+))(\s+)"(.*?)"/i
|
|
||||||
IMAGE_URL_WITH_CLASS = /(\w+)(\s+)((https?:\/\/|\/)(\S+))/i
|
|
||||||
IMAGE_URL = /((https?:\/\/|\/)(\S+))/i
|
|
||||||
def initialize(tag_name, markup, tokens)
|
|
||||||
super
|
|
||||||
if markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION_AND_LINK
|
|
||||||
@class = $1
|
|
||||||
@url = $3
|
|
||||||
@caption = $7
|
|
||||||
@link = $9
|
|
||||||
elsif markup =~ IMAGE_URL_WITH_CLASS_AND_CAPTION
|
|
||||||
@class = $1
|
|
||||||
@url = $3
|
|
||||||
@caption = $7
|
|
||||||
elsif markup =~ IMAGE_URL_WITH_CAPTION
|
|
||||||
@url = $1
|
|
||||||
@caption = $5
|
|
||||||
elsif markup =~ IMAGE_URL_WITH_CLASS
|
|
||||||
@class = $1
|
|
||||||
@url = $3
|
|
||||||
elsif markup =~ IMAGE_URL
|
|
||||||
@url = $1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
def render(context)
|
|
||||||
if @class
|
|
||||||
source = "<figure class='#{@class}'>"
|
|
||||||
else
|
|
||||||
source = "<figure>"
|
|
||||||
end
|
|
||||||
if @link
|
|
||||||
source += "<a href=\"#{@link}\">"
|
|
||||||
end
|
|
||||||
source += "<img src=\"#{@url}\">"
|
|
||||||
if @link
|
|
||||||
source += "</a>"
|
|
||||||
end
|
|
||||||
source += "<figcaption>#{@caption}</figcaption>" if @caption
|
|
||||||
source += "</figure>"
|
|
||||||
source
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Liquid::Template.register_tag('image', Jekyll::ImageTag)
|
|
||||||
|
|
||||||
is written as this Hugo shortcode:
|
|
||||||
|
|
||||||
<!-- image -->
|
|
||||||
<figure {{ with .Get "class" }}class="{{.}}"{{ end }}>
|
|
||||||
{{ with .Get "link"}}<a href="{{.}}">{{ end }}
|
|
||||||
<img src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}"{{ end }} />
|
|
||||||
{{ if .Get "link"}}</a>{{ end }}
|
|
||||||
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
|
|
||||||
<figcaption>{{ if isset .Params "title" }}
|
|
||||||
{{ .Get "title" }}{{ end }}
|
|
||||||
{{ if or (.Get "caption") (.Get "attr")}}<p>
|
|
||||||
{{ .Get "caption" }}
|
|
||||||
{{ with .Get "attrlink"}}<a href="{{.}}"> {{ end }}
|
|
||||||
{{ .Get "attr" }}
|
|
||||||
{{ if .Get "attrlink"}}</a> {{ end }}
|
|
||||||
</p> {{ end }}
|
|
||||||
</figcaption>
|
|
||||||
{{ end }}
|
|
||||||
</figure>
|
|
||||||
<!-- image -->
|
|
||||||
|
|
||||||
### Usage
|
|
||||||
I simply changed:
|
|
||||||
|
|
||||||
{% image full http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg "One of my favorite touristy-type photos. I secretly waited for the good light while we were "having fun" and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing." ->http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/ %}
|
|
||||||
|
|
||||||
to this (this example uses a slightly extended version named `fig`, different than the built-in `figure`):
|
|
||||||
|
|
||||||
{{%/* fig class="full" src="http://farm5.staticflickr.com/4136/4829260124_57712e570a_o_d.jpg" title="One of my favorite touristy-type photos. I secretly waited for the good light while we were having fun and took this. Only regret: a stupid pole in the top-left corner of the frame I had to clumsily get rid of at post-processing." link="http://www.flickr.com/photos/alexnormand/4829260124/in/set-72157624547713078/" */%}}
|
|
||||||
|
|
||||||
As a bonus, the shortcode named parameters are, arguably, more readable.
|
|
||||||
|
|
||||||
## Finishing touches
|
|
||||||
### Fix content
|
|
||||||
Depending on the amount of customization that was done with each post with Jekyll, this step will require more or less effort. There are no hard and fast rules here except that `hugo server --watch` is your friend. Test your changes and fix errors as needed.
|
|
||||||
|
|
||||||
### Clean up
|
|
||||||
You'll want to remove the Jekyll configuration at this point. If you have anything else that isn't used, delete it.
|
|
||||||
|
|
||||||
## A practical example in a diff
|
|
||||||
[Hey, it's Alex](http://heyitsalex.net/) was migrated in less than a _father-with-kids day_ from Jekyll to Hugo. You can see all the changes (and screw-ups) by looking at this [diff](https://github.com/alexandre-normand/alexandre-normand/compare/869d69435bd2665c3fbf5b5c78d4c22759d7613a...b7f6605b1265e83b4b81495423294208cc74d610).
|
|
||||||
@@ -3,39 +3,8 @@ title: Introduction
|
|||||||
type: docs
|
type: docs
|
||||||
---
|
---
|
||||||
|
|
||||||
# Example of RTL page
|
# Hugo Book Theme / RTL
|
||||||
|
|
||||||
{{% columns %}}
|
This page demonstrates right-to-left layout support. Hebrew is configured with `direction: rtl` in the site config.
|
||||||
## Astris ipse furtiva
|
|
||||||
|
|
||||||
Est in vagis et Pittheus tu arge accipiter regia iram vocatur nurus. Omnes ut
|
The entire page layout mirrors automatically, including the sidebar menu and table of contents.
|
||||||
olivae sensit **arma sorori** deducit, inesset **crudus**, ego vetuere aliis,
|
|
||||||
modo arsit? Utinam rapta fiducia valuere litora _adicit cursu_, ad facies
|
|
||||||
|
|
||||||
<--->
|
|
||||||
|
|
||||||
## Suis quot vota
|
|
||||||
|
|
||||||
Ea _furtique_ risere fratres edidit terrae magis. Colla tam mihi tenebat:
|
|
||||||
miseram excita suadent es pecudes iam. Concilio _quam_ velatus posset ait quod
|
|
||||||
nunc! Fragosis suae dextra geruntur functus vulgata.
|
|
||||||
{{% /columns %}}
|
|
||||||
|
|
||||||
|
|
||||||
## Tempora nisi nunc
|
|
||||||
|
|
||||||
Lorem **markdownum** emicat gestu. Cannis sol pressit ducta. **Est** Idaei,
|
|
||||||
tremens ausim se tutaeque, illi ulnis hausit, sed, lumina cutem. Quae avis
|
|
||||||
sequens!
|
|
||||||
|
|
||||||
var panel = ram_design;
|
|
||||||
if (backup + system) {
|
|
||||||
file.readPoint = network_native;
|
|
||||||
sidebar_engine_device(cell_tftp_raster,
|
|
||||||
dual_login_paper.adf_vci.application_reader_design(
|
|
||||||
graphicsNvramCdma, lpi_footer_snmp, integer_model));
|
|
||||||
}
|
|
||||||
|
|
||||||
## Locis suis novi cum suoque decidit eadem
|
|
||||||
|
|
||||||
Idmoniae ripis, at aves, ali missa adest, ut _et autem_, et ab?
|
|
||||||
|
|||||||
@@ -3,77 +3,8 @@ title: 介绍
|
|||||||
type: docs
|
type: docs
|
||||||
---
|
---
|
||||||
|
|
||||||
# 中文索引页
|
# Hugo Book 主题
|
||||||
|
|
||||||
{{% columns %}}
|
这是中文翻译的示例页面,用于演示多语言功能。
|
||||||
## Astris ipse furtiva
|
|
||||||
|
|
||||||
Est in vagis et Pittheus tu arge accipiter regia iram vocatur nurus. Omnes ut
|
完整文档请参考英文版本。
|
||||||
olivae sensit **arma sorori** deducit, inesset **crudus**, ego vetuere aliis,
|
|
||||||
modo arsit? Utinam rapta fiducia valuere litora _adicit cursu_, ad facies
|
|
||||||
|
|
||||||
<--->
|
|
||||||
|
|
||||||
## Suis quot vota
|
|
||||||
|
|
||||||
Ea _furtique_ risere fratres edidit terrae magis. Colla tam mihi tenebat:
|
|
||||||
miseram excita suadent es pecudes iam. Concilio _quam_ velatus posset ait quod
|
|
||||||
nunc! Fragosis suae dextra geruntur functus vulgata.
|
|
||||||
{{% /columns %}}
|
|
||||||
|
|
||||||
|
|
||||||
## Tempora nisi nunc
|
|
||||||
|
|
||||||
Lorem **markdownum** emicat gestu. Cannis sol pressit ducta. **Est** Idaei,
|
|
||||||
tremens ausim se tutaeque, illi ulnis hausit, sed, lumina cutem. Quae avis
|
|
||||||
sequens!
|
|
||||||
|
|
||||||
var panel = ram_design;
|
|
||||||
if (backup + system) {
|
|
||||||
file.readPoint = network_native;
|
|
||||||
sidebar_engine_device(cell_tftp_raster,
|
|
||||||
dual_login_paper.adf_vci.application_reader_design(
|
|
||||||
graphicsNvramCdma, lpi_footer_snmp, integer_model));
|
|
||||||
}
|
|
||||||
public_keyboard_docking += error.controller_gibibyte_plug.ip(4,
|
|
||||||
asciiPetaflops, software(supercomputer_compatible_status + 4));
|
|
||||||
dynamic_disk.indexModeLaptop = bufferTftpReality;
|
|
||||||
var export_vlog_sequence = trinitron_flowchart + supercomputer_cluster_rj(
|
|
||||||
-1, toolbar_powerpoint_query, -2 / multiprocessing_impression);
|
|
||||||
|
|
||||||
## Locis suis novi cum suoque decidit eadem
|
|
||||||
|
|
||||||
Idmoniae ripis, at aves, ali missa adest, ut _et autem_, et ab? Venit spes
|
|
||||||
versus finis sermonibus patefecit murum nec est sine oculis. _Ille_ inmota
|
|
||||||
macies domoque caelestia cadit tantummodo scelus procul, corde!
|
|
||||||
|
|
||||||
1. Dolentem capi parte rostro alvum habentem pudor
|
|
||||||
2. Fulgentia sanguine paret
|
|
||||||
3. E punior consurgit lentus
|
|
||||||
4. Vox hasta eras micantes
|
|
||||||
|
|
||||||
## Facibus pharetrae indetonsusque indulsit sic incurrite foliis
|
|
||||||
|
|
||||||
Nefandam et prisci palmas! Blandita cutis flectitur montis macies, te _nati_
|
|
||||||
Latiis; turbaque inferias. Virginis tibi peracta avidusque facies caper nec, e
|
|
||||||
at ademptae, mira.
|
|
||||||
|
|
||||||
direct *= font(inputScareware(sliHome), crossplatform.byte(
|
|
||||||
ppl_encryption.excel_e_rte(integratedModelModifier), timeVirtual,
|
|
||||||
floating_speakers.media_printer(us, yahoo, primaryPhp)));
|
|
||||||
friendly_metal_flatbed(cd, isoPrimaryStorage(reader), dmaMirrored);
|
|
||||||
if (parse_flash_cron.metalGif(1, adServiceDevice, utility)) {
|
|
||||||
adf -= operation_cdma_samba;
|
|
||||||
imapGif.switch += torrent;
|
|
||||||
} else {
|
|
||||||
pmu.disk_captcha = digital_ppp_pci + recursionTransistor(5, dram);
|
|
||||||
ajax_service += grayscalePythonLock;
|
|
||||||
google_scroll_capacity = ftp + engine_dslam_sidebar / tape - 1;
|
|
||||||
}
|
|
||||||
drive_rw = zipTftp;
|
|
||||||
var suffix = software_router_extension.dimm_ddr(-5,
|
|
||||||
kernel_digital_minisite);
|
|
||||||
|
|
||||||
Vocavit toto; alas **mitis** maestus in liquidarum ab legi finitimosque dominam
|
|
||||||
tibi subitus; Orionis vertitur nota. Currere alti etiam seroque cernitis
|
|
||||||
innumeris miraturus amplectique collo sustinet quemque! Litora ante turba?
|
|
||||||
|
|||||||
+7
-18
@@ -59,30 +59,24 @@ enableGitInfo = true
|
|||||||
|
|
||||||
[menu]
|
[menu]
|
||||||
[[menu.home]]
|
[[menu.home]]
|
||||||
name = 'Documentation'
|
name = 'About'
|
||||||
pageRef = '/docs/example/'
|
pageRef = '/docs/introduction/'
|
||||||
weight = 1
|
weight = 1
|
||||||
|
|
||||||
[[menu.home]]
|
[[menu.home]]
|
||||||
pageRef = '/docs/example/'
|
name = 'Documentation'
|
||||||
weight = 10
|
pageRef = '/docs/getting-started/'
|
||||||
parent = 'Documentation'
|
weight = 2
|
||||||
|
|
||||||
[[menu.home]]
|
|
||||||
name = 'Shortcodes'
|
|
||||||
pageRef = '/docs/shortcodes/buttons/'
|
|
||||||
weight = 20
|
|
||||||
parent = 'Documentation'
|
|
||||||
|
|
||||||
[[menu.home]]
|
[[menu.home]]
|
||||||
name = 'Showcases'
|
name = 'Showcases'
|
||||||
pageRef = '/showcases/'
|
pageRef = '/showcases/'
|
||||||
weight = 2
|
weight = 3
|
||||||
|
|
||||||
[[menu.home]]
|
[[menu.home]]
|
||||||
name = 'Github'
|
name = 'Github'
|
||||||
url = 'https://github.com/alex-shpak/hugo-book/'
|
url = 'https://github.com/alex-shpak/hugo-book/'
|
||||||
weight = 3
|
weight = 4
|
||||||
|
|
||||||
# [[menu.before]]
|
# [[menu.before]]
|
||||||
[[menu.after]]
|
[[menu.after]]
|
||||||
@@ -90,11 +84,6 @@ enableGitInfo = true
|
|||||||
url = 'https://github.com/alex-shpak/hugo-book/'
|
url = 'https://github.com/alex-shpak/hugo-book/'
|
||||||
weight = 10
|
weight = 10
|
||||||
|
|
||||||
[[menu.after]]
|
|
||||||
name = 'Hugo Themes'
|
|
||||||
url = 'https://themes.gohugo.io/themes/hugo-book/'
|
|
||||||
weight = 20
|
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
# (Optional, default light) Sets color theme: light, dark or auto.
|
# (Optional, default light) Sets color theme: light, dark or auto.
|
||||||
# Theme 'auto' switches between dark and light modes based on browser/os preferences
|
# Theme 'auto' switches between dark and light modes based on browser/os preferences
|
||||||
|
|||||||
+15
-15
@@ -55,27 +55,23 @@ languages:
|
|||||||
|
|
||||||
menu:
|
menu:
|
||||||
home:
|
home:
|
||||||
- name: "Documentation"
|
- name: "About"
|
||||||
pageRef: "/docs/example/"
|
pageRef: "/docs/introduction/"
|
||||||
weight: 1
|
weight: 1
|
||||||
- pageRef: "/docs/example/"
|
- name: "Documentation"
|
||||||
weight: 10
|
pageRef: "/docs/getting-started/"
|
||||||
parent: "Documentation"
|
weight: 2
|
||||||
- name: "Shortcodes"
|
|
||||||
pageRef: "/docs/shortcodes/buttons/"
|
|
||||||
weight: 20
|
|
||||||
parent: "Documentation"
|
|
||||||
- name: "Showcases"
|
- name: "Showcases"
|
||||||
pageRef: "/showcases/"
|
pageRef: "/showcases/"
|
||||||
weight: 2
|
weight: 3
|
||||||
- name: "Github"
|
- name: "Github"
|
||||||
url: "https://github.com/alex-shpak/hugo-book/"
|
url: "https://github.com/alex-shpak/hugo-book/"
|
||||||
weight: 3
|
weight: 4
|
||||||
|
|
||||||
# before: []
|
# before: []
|
||||||
after:
|
after:
|
||||||
- name: "Github"
|
- name: "Github"
|
||||||
url: "https://github.com/alex-shpak/hugo-book"
|
url: "https://github.com/alex-shpak/hugo-book/"
|
||||||
weight: 10
|
weight: 10
|
||||||
- name: "Hugo Themes"
|
- name: "Hugo Themes"
|
||||||
url: "https://themes.gohugo.io/themes/hugo-book/"
|
url: "https://themes.gohugo.io/themes/hugo-book/"
|
||||||
@@ -104,15 +100,19 @@ params:
|
|||||||
# For backward compatibility you can set '*' to render all sections to menu. Acts same as '/'
|
# For backward compatibility you can set '*' to render all sections to menu. Acts same as '/'
|
||||||
BookSection: docs
|
BookSection: docs
|
||||||
|
|
||||||
|
# Here for backward compatibility, not required.
|
||||||
|
# It's here as an example how to use it with BookLastChangeLink or BookEditLink
|
||||||
|
BookRepo: "https://github.com/alex-shpak/hugo-book/"
|
||||||
|
|
||||||
# (Optional, default none) Set template for commit link for the page. Requires enableGitInfo.
|
# (Optional, default none) Set template for commit link for the page. Requires enableGitInfo.
|
||||||
# When set enabled 'Last Modified' and a link to the commit in the footer of the page.
|
# When set enabled 'Last Modified' and a link to the commit in the footer of the page.
|
||||||
# Param is executed as template using .Site, .Page and .GitInfo as context.
|
# Param is executed as template using .Site, .Page and .GitInfo as context.
|
||||||
BookLastChangeLink: "https://github.com/alex-shpak/hugo-book/commit/{{ .GitInfo.Hash }}"
|
BookLastChangeLink: "{{ .Site.Params.BookRepo }}/commit/{{ .GitInfo.Hash }}"
|
||||||
|
|
||||||
# (Optional, default none) Set template for edit page link.
|
# (Optional, default none) Set template for edit page link.
|
||||||
# When set enabled 'Edit this page' link in the footer of the page.
|
# When set enabled 'Edit this page' link in the footer of the page.
|
||||||
# Param is executed as template using .Site, .Page and .Path as context.
|
# Param is executed as template using .Site, .Page and .Path as context.
|
||||||
BookEditLink: "https://github.com/alex-shpak/hugo-book/edit/main/exampleSite/{{ .Path }}"
|
BookEditLink: "{{ .Site.Params.BookRepo }}/edit/main/exampleSite/{{ .Path }}"
|
||||||
|
|
||||||
# (Optional, default 'January 2, 2006') Configure the date format used on the pages
|
# (Optional, default 'January 2, 2006') Configure the date format used on the pages
|
||||||
# - In git information
|
# - In git information
|
||||||
@@ -120,7 +120,7 @@ params:
|
|||||||
# https://gohugo.io/functions/time/format/
|
# https://gohugo.io/functions/time/format/
|
||||||
BookDateFormat: "January 2, 2006"
|
BookDateFormat: "January 2, 2006"
|
||||||
|
|
||||||
# (Optional, default true) Enables search function with flexsearch,
|
# (Optional, default true) Enables search function with fuse.js.,
|
||||||
# Index is built on fly, therefore it might slowdown your website.
|
# Index is built on fly, therefore it might slowdown your website.
|
||||||
# Configuration for indexing can be adjusted in i18n folder per language.
|
# Configuration for indexing can be adjusted in i18n folder per language.
|
||||||
BookSearch: true
|
BookSearch: true
|
||||||
|
|||||||
@@ -10,15 +10,6 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
|
||||||
{{ with .OutputFormats.Get "txt" }}
|
|
||||||
<a class="flex align-center" href="{{ .RelPermalink }}">
|
|
||||||
<img src="{{ partial "docs/icon" "markdown" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Markdown" }}" />
|
|
||||||
<span>{{ partial "docs/text/i18n" "Source" }}</span>
|
|
||||||
</a>
|
|
||||||
{{ end }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
{{ if and .File .Site.Params.BookEditLink }}
|
{{ if and .File .Site.Params.BookEditLink }}
|
||||||
<a class="flex align-center" href="{{ partial "docs/links/edit" . }}" target="_blank" rel="noopener edit">
|
<a class="flex align-center" href="{{ partial "docs/links/edit" . }}" target="_blank" rel="noopener edit">
|
||||||
|
|||||||
Reference in New Issue
Block a user