Add the module as a dependency using it’s git link
hugo mod get github.com/McShelby/hugo-theme-relearn
Confirm
cat go.mod
add the theme to config.toml
# add this line to config.toml and save
theme = ["github.com/McShelby/hugo-theme-relearn"]
Confirm by viewing site
hugo serve
# visit browser at http://localhost:1313/ to view site
Adding a new “chapter” page
hugo new --kind chapter Chapter/_index.md
Add a home page
hugo new --kind home _index.md
Add a default page
hugo new <chapter>/<name>/_index.md
or
hugo new <chapter>/<name>.md
You will need to change some options in _index.md
+++
# is this a "chaper"?
chapter=true
archetype = "chapter"
# page title name
title = "Linux"
# The "chapter" number
weight = 1
+++
Adding a “content page” under a category
hugo new basics/first-content.md
Create a sub directory:
hugo new basics/second-content/_index.md
change draft = true to draft = false in the content page to make a page render.
Global site parameters
Add these to your config.toml file and edit as you please
[params]# This controls whether submenus will be expanded (true), or collapsed (false) in the# menu; if no setting is given, the first menu level is set to false, all others to true;# this can be overridden in the pages frontmatteralwaysopen= true
# Prefix URL to edit current page. Will display an "Edit" button on top right hand corner of every page.# Useful to give opportunity to people to create merge request for your doc.# See the config.toml file from this documentation site to have an example.editURL=""# Author of the site, will be used in meta informationauthor=""# Description of the site, will be used in meta informationdescription=""# Shows a checkmark for visited pages on the menushowVisitedLinks= false
# Disable search function. It will hide search bardisableSearch= false
# Disable search in hidden pages, otherwise they will be shown in search boxdisableSearchHiddenPages= false
# Disables hidden pages from showing up in the sitemap and on Google (et all), otherwise they may be indexed by search enginesdisableSeoHiddenPages= false
# Disables hidden pages from showing up on the tags page although the tag term will be displayed even if all pages are hiddendisableTagHiddenPages= false
# Javascript and CSS cache are automatically busted when new version of site is generated.# Set this to true to disable this behavior (some proxies don't handle well this optimization)disableAssetsBusting= false
# Set this to true if you want to disable generation for generator version meta tags of hugo and the theme;# don't forget to also set Hugo's disableHugoGeneratorInject=true, otherwise it will generate a meta tag into your home pagedisableGeneratorVersion= false
# Set this to true to disable copy-to-clipboard button for inline code.disableInlineCopyToClipBoard= false
# A title for shortcuts in menu is set by default. Set this to true to disable it.disableShortcutsTitle= false
# If set to false, a Home button will appear below the search bar on the menu.# It is redirecting to the landing page of the current language if specified. (Default is "/")disableLandingPageButton= true
# When using mulitlingual website, disable the switch language button.disableLanguageSwitchingButton= false
# Hide breadcrumbs in the header and only show the current page titledisableBreadcrumb= true
# If set to true, hide table of contents menu in the header of all pagesdisableToc= false
# If set to false, load the MathJax module on every page regardless if a MathJax shortcode is presentdisableMathJax= false
# Specifies the remote location of the MathJax jscustomMathJaxURL="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"# Initialization parameter for MathJax, see MathJax documentationmathJaxInitialize="{}"# If set to false, load the Mermaid module on every page regardless if a Mermaid shortcode or Mermaid codefence is presentdisableMermaid= false
# Specifies the remote location of the Mermaid jscustomMermaidURL="https://unpkg.com/mermaid/dist/mermaid.min.js"# Initialization parameter for Mermaid, see Mermaid documentationmermaidInitialize="{ \"theme\": \"default\" }"# If set to false, load the Swagger module on every page regardless if a Swagger shortcode is presentdisableSwagger= false
# Specifies the remote location of the RapiDoc jscustomSwaggerURL="https://unpkg.com/rapidoc/dist/rapidoc-min.js"# Initialization parameter for Swagger, see RapiDoc documentationswaggerInitialize="{ \"theme\": \"light\" }"# Hide Next and Previous page buttons normally displayed full height beside contentdisableNextPrev= true
# Order sections in menu by "weight" or "title". Default to "weight";# this can be overridden in the pages frontmatterordersectionsby="weight"# Change default color scheme with a variant one. Eg. can be "auto", "red", "blue", "green" or an array like [ "blue", "green" ].themeVariant="auto"# Change the title separator. Default to "::".titleSeparator="-"# If set to true, the menu in the sidebar will be displayed in a collapsible tree view. Although the functionality works with old browsers (IE11), the display of the expander icons is limited to modern browserscollapsibleMenu= false
# If a single page can contain content in multiple languages, add those hereadditionalContentLanguage=["en"]# If set to true, no index.html will be appended to prettyURLs; this will cause pages not# to be servable from the file systemdisableExplicitIndexURLs= false
# For external links you can define how they are opened in your browser; this setting will only be applied to the content area but not the shortcut menuexternalLinkTarget="_blank"
Syntax highlighting
Supports a variety of [Code Syntaxes]
To select the syntax, wrap the code in backticks and place the syntax by the first set of backticks.
```bash
echo hello
\```
Adding tags
Tags are displayed in order at the top of the page. They will also display using the menu shortcut made further down.
Add tags to a page:
+++tags = ["tutorial", "theme"]
title = "Theme tutorial"weight = 15+++
Add to config.toml with the chosen theme for the “style” option:
[markup]
[markup.highlight]
# if `guessSyntax = true`, there will be no unstyled code even if no language# was given BUT Mermaid and Math codefences will not work anymore! So this is a# mandatory setting for your site if you want to use Mermaid or Math codefences guessSyntax = false# choose a color theme or create your own style = "base16-snazzy"
This theme has a bunch of editable customizations called partials. You can overwrite the default partials by putting new ones in /layouts/partials/.
to customize “partials”, create a “partials” directory under site/layouts/
cd layouts
mkdir partials
cd partials
You can find all of the partials available for this theme here
Change the site logo using the logo.html partial
Create logo.html in /layouts/partials
vim logo.html
Add the content you want in html. This can be an img html tag referencing an image in the static folder. Or even basic text. Here is the basic syntax of an html page, adding “Perfect Dark Mode” as the text to display:
<!DOCTYPE html>
<html>
<body>
<h3>Perfect Dark Mode</h3>
</body>
</html>
Add a favicon to your site
This is pasted from the relearn site. Add Favicon and edit *
If your favicon is a SVG, PNG or ICO, just drop off your image in your local static/images/ folder and name it favicon.svg, favicon.png or favicon.ico respectively.
If no favicon file is found, the theme will lookup the alternative filename logo in the same location and will repeat the search for the list of supported file types.
If you need to change this default behavior, create a new file in layouts/partials/ named favicon.html. Then write something like this: