Go to file
2023-01-03 00:45:12 +00:00
archetypes initial commit: combine book with quartz 2023-01-01 23:41:14 +00:00
assets improve fonts 2023-01-03 00:45:12 +00:00
content improve fonts 2023-01-03 00:45:12 +00:00
data initial commit: combine book with quartz 2023-01-01 23:41:14 +00:00
i18n initial commit: combine book with quartz 2023-01-01 23:41:14 +00:00
images initial commit: combine book with quartz 2023-01-01 23:41:14 +00:00
layouts improve fonts 2023-01-03 00:45:12 +00:00
resources/_gen/assets/scss improve fonts 2023-01-03 00:45:12 +00:00
static improve fonts 2023-01-03 00:45:12 +00:00
.gitignore initial commit: combine book with quartz 2023-01-01 23:41:14 +00:00
.gitmodules initial commit: combine book with quartz 2023-01-01 23:41:14 +00:00
config.yaml improve fonts 2023-01-03 00:45:12 +00:00
go.mod initial commit: combine book with quartz 2023-01-01 23:41:14 +00:00
LICENSE initial commit: combine book with quartz 2023-01-01 23:41:14 +00:00
Makefile initial commit: combine book with quartz 2023-01-01 23:41:14 +00:00
README.md initial commit: combine book with quartz 2023-01-01 23:41:14 +00:00
theme.toml initial commit: combine book with quartz 2023-01-01 23:41:14 +00:00

Amethyst Hugo Theme

Hugo License: MIT

Amethyst combines the navigational features of hugo-book with the Obsidian integrations of quartz to provide a hassle-free place to store and host personal notes or documentation.

Insert screenshot here

Features

  • Most of the features of the original themes (Quartz and Book)
  • Mobile-friendly
  • Multi-language support
  • Customizable
  • Dark Mode
  • LaTeX support
  • Obsidian-style back/forward links and page previews
  • Interactive graph view
  • Tab cards for practice problems

Requirements

Installation

Install as git submodule

Navigate to your hugo project root and run:

git submodule add https://github.com/64bitpandas/amethyst themes/amethyst

Then run hugo (or set theme = "amethyst"/theme: amethyst in configuration file)

hugo server --minify --theme amethyst

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 config.toml:

[module]
[[module.imports]]
path = 'github.com/alex-shpak/hugo-book'

Then, to load/update the theme module and run hugo:

hugo mod get -u
hugo server --minify

Creating site from scratch

Below is an example on how to create a new site from scratch:

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 .
hugo server --minify --theme hugo-book

Configuration

Site Configuration

Most configuration can be done by creating a config.yaml file in the root directory and editing the parameters. You can start by copying the example here.

Graph-specific configuration can be added to data/graphConfig.yaml. (Example here)

Multi-Language Support

Theme supports Hugo's multilingual mode, 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:

# 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 (if BookMenuBundle not set)
weight = 10

# (Optional) Set to 'true' to mark page as flat section in file-tree menu (if BookMenuBundle not set)
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 (if BookMenuBundle not set)
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 'false' to exclude page from search index.
bookSearchExclude = true

# (Optional) Set explicit href attribute for this page in a menu (if BookMenuBundle not set)
bookHref = ''

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

Plugins

There are a few features implemented as plugable 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

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>

To disable Open Graph inclusion you can create your own empty file \layouts\_internal\opengraph.html. In fact almost empty not quite empty because an empty file looks like absent for HUGO. For example:

<!-- -->

Shortcodes

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.

[markup.goldmark.renderer]
  unsafe = true

If you are using config.yaml or config.json, consult the configuration markup

Versioning

This theme follows a simple incremental versioning. e.g. v1, v2 and so on. There might be breaking changes between versions.

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 master branch and update your website when needed.

Contributing

Extra credits to contributors

Contributions are welcome and I will review and consider pull requests.
Primary goals are:

  • Keep it simple.
  • Keep minimal (or zero) default configuration.
  • Avoid interference with user-defined layouts.
  • Avoid using JS if it can be solved by CSS.

Feel free to open issues if you find missing configuration or customisation options.