Authoring
Learn how to create and organize your content pages.
Your content's directory structure
All things front matter
What page meta information are available
Reference of CommonMark and Markdown extensions
How to link your content
Learn how to create and organize your content pages.
Your content's directory structure
All things front matter
What page meta information are available
Reference of CommonMark and Markdown extensions
How to link your content
In Hugo, pages are the core of your site.
The theme generates the navigation menu out of the given directory structure.
Organize your site like any other Hugo project. Typically, you will have a content directory with all your pages.
While you can also go different, _index.md (with an underscore) is recommended for each directory, it’s your directory’s home page.
See Hugo’s guide for content to learn more.
How to vary layouts by using page designs
Setting the behavior of the menus
What options are available for links and images
Configure the topbar
All front matter for the Relearn theme
Page designs are used to provide different layouts for your pages.
A page is displayed by exactly one page design and is represented by Hugo’s reserved type front matter.
The Relearn theme ships with the page designs home, chapter, and default for the HTML output format but you can define further custom page designs.
Regardless of shipped or custom page design, you are using them in the same way.
If you have an archetype file, you can just do
If you are creating your Markdown files manually, you can achieve the same by just setting type='chapter' in the front matter to make your page displayed with the chapter page design.
If no type is set in your front matter or the page design doesn’t exist for a given output format, the page is treated as if type='default' was set.
A Home page is the starting page of your project. It’s best to have only one page of this kind in your project.
To create a home page, run the following command
A Chapter displays a page meant to be used as introduction for a set of child pages.
Commonly, it contains a title front matter and a short description in the content.
To create a chapter page, run the following command
If a numerical weight front matter is set, it will be used to generate the subtitle of the chapter page. Set the number to a consecutive value starting at 1 for each new chapter on the same directory level.
A Default page is any other content page.
To create a default page, run either one of the following commands
or
or
Option Front Matter By default, external links open in the same browser tab. To change this, use the externalLinkTarget setting with a proper link target.
To set default values for all links, use link effects.
For example, this will open all external links in a new tab
Option Front Matter You can use link.errorlevel and image.errorlevel to control what should happen if a local link can not be resolved to a page and/or a resource.
If not set or empty, any unresolved link is written as given into the resulting output. If set to warning the same happens and an additional warning is printed in the built console. If set to error an error message is printed and the build is aborted.
Please note that this can not resolve files inside of your static directory. The file must be a resource of the page or the site.
Link warnings are also available for the include and openapi shortcodes.
Option Front Matter In case you want to use link warnings but are bothered by false negatives, you can configure an ignore list of regular expressions. The referenced address will be checked against all regexes of this list. If the address matches at least one regex, no output will be written to the console. The check uses Hugo’s findRE function.
Option Front Matter External URLs can be checked for validity during build. It will only be checked if the URL does not match a urlIgnoreCheck pattern.
This page is about how to configure the topbar using configuration options. If you want to add further buttons or functionality, see this section.
Your topbar contains the following elements. Some of them are configuarable:
editURL parameter is setOption Front Matter Set disableToc=true to hide the TOC button on all pages. If the button is hidden, also the keyboard shortcut is disabled. This can be overridden in a page’s front matter.
Option Front Matter Set disableBreadcrumb=true to hide the breadcrumb in the topbar.
Further breadcrumbs settings can be found in the content configuration section.
Option Front Matter If editURL is set to a URL, an edit button will be shown in the topbar. If the button is hidden, also the keyboard shortcut is disabled.
The value can contain the macro ${FilePath} which will be replaced by the file path of your displayed page. If no ${FilePath} is given in the value, the value is treated as if the ${FilePath} was appended at the end of the value. This can be overridden in the pages front matter.
Option Front Matter You can hide the Markdown button if the Markdown output format is active by setting disableMarkdownButton=true.
Option Front Matter You can hide the Source button if the Source output format is active by setting disableSourceButton=true.
Option Front Matter You can hide the print button if the print output format is active by setting disablePrintButton=true.
Option Front Matter You can hide the previous/next buttons by setting disableNextPrev=true. If the buttons are hidden, also the keyboard shortcuts are disabled.
Every Hugo page must have front matter.
In addition to Hugo’s standard front matter, the Relearn theme offers extras settings listed here.
Throughout the documentation, theme-specific front matter is marked with a Front Matter badge.
Add theme front matter directly to the root of your page’s front matter. For example:
Here’s a list of all available front matter with example values. Default values are described in the annotated example below or in each front matter’s documentation.
The title will be used in the heading and meta information of your HTML.
A page without a title is treated as if hidden=true has been set.
The description is used for generating HTML meta information, in the children shortcode and in social media meta information.
If not set, the set value of your site’s hugo.toml is used for the HTML meta information and social media meta information. It appears empty for the children shortcode.
The theme adds social media meta tags including feature images for the Open Graph protocol and Twitter Cards to your site. These are configured as mentioned in the linked Hugo docs.
Front Matter You can hide your pages from the menu by setting hidden=true.
For Hugo menus, you have to set params.hidden=true instead.
See how you can further configure visibility throughout your site.
Front Matter In the page front matter, add a headingPre to insert any HTML code before the title heading. You can also set headingPost to insert HTML code after the title heading.
You also may want to apply further CSS in this case.
Front Matter If you use the default layouts/partials/content-footer.html is not overridden by you, it will display authoring information, namely
AuthorName if GitInfo is active, otherwise LastModifierDisplayName front matterAuthorEmail if GitInfo is active, otherwise LastModifierEmail front matterAuthorDate if GitInfo is active, otherwise Hugo’s date front matterSee how to further configure this information on a site-wide basis.
Let’s face it: Writing content for the web is tiresome. WYSIWYG editors help alleviate this task, but they generally result in horrible code, or worse yet, ugly web pages.
Markdown is a better way to write HTML, without all the complexities and ugliness that usually accompanies it.
Some of the key benefits are:
John Gruber, the author of Markdown, puts it like this:
The overriding design goal for Markdown’s formatting syntax is to make it as readable as possible. The idea is that a Markdown-formatted document should be publishable as-is, as plain text, without looking like it’s been marked up with tags or formatting instructions. While Markdown’s syntax has been influenced by several existing text-to-HTML filters, the single biggest source of inspiration for Markdown’s syntax is the format of plain text email. John Gruber
Bookmark this page for easy future reference!
If not otherwise noted, the shown examples adhere to the CommonMark standard. In addition the theme supports the following extensions that can be activated in your hugo.toml or are built into the theme:
GFM Extension on top of standard Markdown adhering to GitHub Flavored Markdown.
PHP Extension on top of standard Markdown adhering to PHP Markdown.
Pants Extension by John Gruber adhering to SmartyPants.
Hugo Hugo Extra Extension supported by Hugo.
Obsidian Extension implemented by Obsidian.
HTML If the usage of HTML is allowed, the theme supports styling for further HTML elements.
Relearn Extension specific to this theme.
In Markdown your content usually spans the whole available document width. This is called a block. Blocks are always separated by whitespace to their adjacent blocks in the resulting document.
Any text not starting with a special sign is written as normal, plain text paragraph block and must be separated to its adjacent blocks by empty lines.
Lorem ipsum dolor sit amet, graecis denique ei vel, at duo primis mandamus.
Et legere ocurreret pri, animal tacimates complectitur ad cum. Cu eum inermis inimicus efficiendi. Labore officiis his ex, soluta officiis concludaturque ei qui, vide sensibus vim ad.
A good idea is to structure your content using headings and subheadings. HTML-headings from h1 through h6 are constructed with a # for each level.
In Hugo you usually don’t use h1 as this is generated by your theme and you should only have one such element in a document.
To further structure your content you can add horizontal rules. They create a “thematic break” between paragraph blocks. In Markdown, you can create it with three consecutive dashes ---.
Lorem ipsum dolor sit amet, graecis denique ei vel, at duo primis mandamus.
Et legere ocurreret pri, animal tacimates complectitur ad cum. Cu eum inermis inimicus efficiendi. Labore officiis his ex, soluta officiis concludaturque ei qui, vide sensibus vim ad.
For quoting blocks of content from another source within your document add > before any text you want to quote.
Blockquotes can also be nested.
Donec massa lacus, ultricies a ullamcorper in, fermentum sed augue. Nunc augue, aliquam non hendrerit ac, commodo vel nisi.
Sed adipiscing elit vitae augue consectetur a gravida nunc vehicula. Donec auctor odio non est accumsan facilisis. Aliquam id turpis in dolor tincidunt mollis ac eu diam.
Mauris sit amet ligula egestas, feugiat metus tincidunt, luctus libero. Donec congue finibus tempor. Vestibulum aliquet sollicitudin erat, ut aliquet purus posuere luctus.
GFM Since Hugo 0.132.0 GitHub alerts are also supported. Please note, that coloring and icons of severities may defer between GitHub and this theme.
If you are in need of more advanced options to style your alerts, like icons, use the notice shortcode.
Advises about risks or negative outcomes of certain actions.
Key information users need to know to achieve their goal.
Information that users might find interesting.
Useful information that users should know, even when skimming content.
Helpful advice for doing things better or more easily.
Urgent info that needs immediate user attention to avoid problems.
Obsidian Since Hugo 0.134.0 Obsidian callouts are also supported. Which enables configurable title text and expand/collapse.
If you are in need of more advanced options to style your alerts, like icons, use the notice shortcode.
Like this one.
You can show importance of a snippet of text with a heavier font-weight by enclosing it with two asterisks **.
I am rendered with bold text
You can emphasize a snippet of text with italics by enclosing it with underscores _.
I am rendered with italicized text
You can mark text in the predefined accent color of your stylesheet.
Hugo Since Hugo 0.126.0, you can activate this through the Hugo Extra Extension in your hugo.toml
HTML You can also use it by configuring Hugo for usage of HTML.
Parts of this text are marked!
You can mark text additions to existing text.
Hugo Since Hugo 0.126.0, you can activate this through the Hugo Extra Extension in your hugo.toml
HTML You can also use it by configuring Hugo for usage of HTML.
The hot, new stuff
GFM You can do strikethroughs by enclosing text with two tildes ~~. See Hugo’s documentation remarks if you want to use this together with the subscript syntax.
Strike through this text
Pants You can combine multiple punctuation characters to single typographic entities. This will only be applied to text outside of code blocks or inline code.
Double quotes " and single quotes ' of enclosed text are replaced by “double curly quotes” and ‘single curly quotes’.
Double dashes -- and triple dashes --- are replaced by en-dash – and em-dash — entities.
Double arrows pointing left << or right >> are replaced by arrow « and » entities.
Three consecutive dots ... are replaced by an ellipsis … entity.
You can also use subscript and superscript text. For more complex stuff, you can use the math shortcode.
Hugo Since Hugo 0.126.0, you can activate this through the Hugo Extra Extension in your hugo.toml
HTML You can also use it by configuring Hugo for usage of HTML.
How many liters H2O fit into 1dm3?
HTML You can use the <kbd> element to style keyboard shortcuts.
Press STRG ALT DEL to end your shift early.
You can write a list of items in which the order of the items does not explicitly matter.
It is possible to nest lists by indenting an item for the next sublevel.
You may use any of -, * or + to denote bullets for each list item but should not switch between those symbols inside one whole list.
You can create a list of items in which the order of items does explicitly matter.
It is possible to nest lists by indenting an item for the next sublevel.
Markdown will automatically number each of your items consecutively. This means, the order number you are providing is irrelevant.
GFM You can add task lists resulting in checked or unchecked non-clickable items
Relearn You can add lists as a tree with configurable icons and colors.
The name can be followed by an optional pipe (|) to define an icon and further optional pipe to define the icon’s color.
More details can be found in the tree shortcode docs.
PHP Definition lists are made of terms and definitions of these terms, much like in a dictionary.
A definition list in Markdown Extra is made of a single-line term followed by a colon and the definition for that term. You can also associate more than one term to a definition.
If you add empty lines around the definition terms, additional vertical space will be generated. Also multiple paragraphs are possible
You can make juice out of it.
You can’t make juice out of it.
Inline snippets of code can be wrapped with backticks `.
In this example, <div></div> is marked as code.
A simple code block can be generated by indenting several lines of code by at least two spaces.
Be impressed by my advanced code:
// Some comments
line 1 of code
line 2 of code
line 3 of code
If you want to gain more control of your code block you can enclose your code by at least three backticks ``` a so called fence.
GFM You can also add a language specifier directly after the opening fence, ```js, and syntax highlighting will automatically be applied according to the selected language in the rendered HTML.
See Code Highlighting for additional documentation.
GFM You can create tables by adding pipes as dividers between each cell, and by adding a line of dashes (also separated by bars) beneath the header. Note that the pipes do not need to be vertically aligned.
| Option | Description |
|---|---|
| data | path to data files to supply the data that will be passed into templates. |
| engine | engine to be used for processing templates. Handlebars is the default. |
| ext | extension to be used for dest files. |
Adding a colon on the left and/or right side of the dashes below any heading will align the text for that column accordingly.
| Option | Number | Description |
|---|---|---|
| data | 1 | path to data files to supply the data that will be passed into templates. |
| engine | 2 | engine to be used for processing templates. Handlebars is the default. |
| ext | 3 | extension to be used for dest files. |
GFM Absolute URLs will automatically be converted into a link.
This is a link to https://example.com.
You can explicitly define links in case you want to use non-absolute URLs or want to give different text.
For even further information, you can add an additional text, displayed in a tooltip on hovering over the link.
Links can be simplyfied for recurring reuse by using a reference ID to later define the URL location. This simplyfies writing if you want to use a link more than once in a document.
PHP Footnotes work mostly like reference-style links. A footnote is made of two things, a marker in the text that will become a superscript number and a footnote definition that will be placed in a list of footnotes.
Usually the list of footnotes will be shown at the end of your document. If we use a footnote in a notice box it will instead be listed at the end of its box.
Footnotes can contain block elements, which means that you can put multiple paragraphs, lists, blockquotes and so on in a footnote. It works the same as for list items, just indent the following paragraphs by four spaces in the footnote definition.
Relearn This theme allows additional non-standard formatting by setting query parameter at the end of the URL. See the link effects docs for a detailed example and how to configure it.
Add query parameter target=_self or target=_blank to override site-wide settings of the target behavior individuallly for each link.
Add query parameter download or download=myfile.gif to force your browser to download the link target instead of opening it.
Images have a similar syntax to links but include a preceding exclamation mark.
Like links, images can also be given a tooltip.
Images can also be linked by reference ID to later define the URL location. This simplyfies writing if you want to use an image more than once in a document.
Relearn This theme allows additional non-standard formatting by setting query parameter at the end of the image URL. See the image effects docs for a detailed example and how to configure it.
Add query parameter width and/or height to the link image to resize the image. Values are CSS values (default is auto).
Add a query parameter classes to the link image to add CSS classes. Add some of the predefined values or even define your own in your CSS.
Add the query parameter lightbox=false to the image link to disable the lightbox.

How to link to pages and resources
How to apply effects to your links
How to apply effects to your images
The usual way to link to a page or a resource is to use a Markdown link in the form of [some page](a-page) or .
Images are searched in the resources of the current page and your global assets directory.
By giving the query parameter lang, containing the language code, you can link to pages of other translations of your site, e.g. [some translated page](my-page?lang=pir).
You can link to different output formats of a page by adding the query parameter format. For example to link to the print format of a page, write [a printable page](my-page?format=print).
The theme offers effects for your linked links.
You can define additional custom link effects and set defaults in your configuration.
The default link effects shipped with the theme are
| Name | Description |
|---|---|
| download | Causes the linked resource to be downloaded instead of shown in your browser. - false: a usual link sending you to the location in your browser- true: a link to download the resource- <string>: a link to download the resource with the given filename |
| target | Whether to show the link in a separate browser tab. - false: shown in the same tab- <string>: a valid a target valueIf the URL is external and externalLinkTarget is set, it replaces the value of the link effect configured on the same level (eg. in your hugo.toml or in the page’s front matter). Nervertheless the resulting value can still be overwritten by the URL query parameter. |
One way to use them is to add them as URL query parameter to each individual link.
This can become cumbersome to be done consistently for the whole site. Instead, you can configure the defaults in your hugo.toml as well as overriding these defaults in a page’s front matter.
Link effects are applied in the following priority order (lowest to highest):
hugo.tomlattributes parameter (highest priority)Explicitly set URL query parameter will override the defaults set for a page or your site. When calling the link partial directly from templates, effects passed via the attributes parameter have the highest priority and will override all other settings.
If an effect accepts boolean values, only setting the parameter name without a value in the URL will set it to true.
Without any settings in your hugo.toml linkEffects defaults to
Front Matter This can be overridden in a pages front matter for example by
Or by explicitly override settings by URL query parameter
The settings applied to the above link would be
When calling the link partial directly from templates, you can pass effect preferences via the attributes parameter. Effect names can be prefixed with no to disable them.
This approach has the highest priority and will override all other effect settings, including URL query parameters. Effect classes are processed but not added to the final HTML class attribute. Non-effect classes pass through unchanged.
For example, class = "download custom-link-class" will enable the download effect and add custom-link-class to the HTML output, but download will not appear in the final class attribute.
The theme offers effects for your linked images.
You can define additional custom image effects and set defaults in your configuration.
The default image effects shipped with the theme are
| Name | Description |
|---|---|
| border | Draws a light thin border around the image |
| dataurl | if the linked image points to a resource, it is converted to a base64 encoded dataurl |
| inlinecontent | if the linked image points to a SVG resource, the content will be used instead of an <img> element, this is useful for applying additional CSS styles to the elements inside of the SVG which is otherwise impossible |
| lazy | Lets the image be lazy loaded |
| lightbox | The image will be clickable to show it enlarged |
| shadow | Draws a shadow around the image to make it appear hovered/glowing |
One way to use them is to add them as URL query parameter to each individually linked image.
This can become cumbersome to be done consistently for the whole site. Instead, you can configure the defaults in your hugo.toml as well as overriding these defaults in a page’s front matter.
Image effects are applied in the following priority order (lowest to highest):
hugo.tomlattributes parameter (highest priority)Explicitly set URL query parameter will override the defaults set for a page or your site. When calling the image partial directly from templates, effects passed via the attributes parameter have the highest priority and will override all other settings.
If an effect accepts boolean values, only setting the parameter name without a value in the URL will set it to true.
Without any settings in your hugo.toml imageEffects defaults to
Front Matter This can be overridden in a pages front matter for example by
Or by explicitly override settings by URL query parameter
The settings applied to the above image would be
When calling the image partial directly from templates, you can pass effect preferences via the attributes parameter. Effect names can be prefixed with no to disable them.
This approach has the highest priority and will override all other effect settings, including URL query parameters. Effect classes are processed but not added to the final HTML class attribute. Non-effect classes pass through unchanged.
For example, class = "nolightbox custom-img-class" will disable the lightbox effect and add custom-img-class to the HTML output, but neither lightbox nor nolightbox will appear in the final class attribute.