Subsct'ns o' Customization

Partials

Us'ble Partials

Ye can call other partials from themes/hugo-relearn-themes/ besides those 'n themes/hugo-relearn-themes/layouts/partials/_relearn. However, us'n partials not mentioned as customiz'ble below might make future updates more challeng'n.

Customiz'ble Partials

Th' Relearrrn theme allows ye t' cust'mize various parts o' th' theme by overrid'n partials. This makes th' theme highly configur'ble.

A bloody rule t' follow: Th' less code a partial contains, th' easier it will be t' update th' theme 'n th' future.

Here’s a list o' partials ye can safely override:

  • layouts/partials/content.html: Th' main rrrambl'n o' a plank. Override this t' display additonal plank metadata.

  • layouts/partials/content-header.html: Th' header above th' title. By default, it shows tags, but ye can change this.

  • layouts/partials/content-footer.html: Th' footer below th' rrrambl'n. By default, it shows author info, modificat'n dates, an' categories. Ye can cust'mize this.

  • layouts/partials/custom-header.html: For add'n custom CSS. Remember t' include th' style HTML tag.

  • layouts/partials/custom-footer.html: For add'n custom JavaScript. Remember t' include th' script HTML tag.

  • layouts/partials/favicon.html: Th' favicon. Ye should definitely cust'mize this.

  • layouts/partials/head'n.html: th' page’s title head'ns

  • layouts/partials/heading-pre.html: Add rrrambl'n before th' page’s title head'ns. Remember t' consider th' headingPre front matter.

  • layouts/partials/heading-post.html: Add rrrambl'n after th' page’s title head'ns. Remember t' consider th' headingPost front matter.

  • layouts/partials/logo.html: Th' logo 'n th' top left corner. Ye should cust'mize this.

  • layouts/partials/menu-pre.html: Add rrrambl'n before menu items. Remember t' consider th' menuPre front matter.

  • layouts/partials/menu-post.html: Add rrrambl'n after menu items. Remember t' consider th' menuPost front matter.

  • layouts/partials/menu-footer.html: Th' footer o' th' left menu.

Ye can override other partials from themes/hugo-relearn-themes/, but be careful as this might make future updates more difficult.

Extending Scripts

A common quest'n be how t' add extra CSS styles or JavaScript t' yer ship. This depends on what ye need.

Add'n JavaScript or Stylesheets t' All Planks

T' add JavaScript files or CSS stylesheets t' every plank, ye can include them 'n layouts/partials/custom-header.html or layouts/partials/custom-footer.html.

However, this can make yer ship larger than necessary if these files be only needed on a few planks. Th' next section explains how t' add dependencies only when needed.

Custom Shorrrtcodes wit' Dependencies

Some shorrrtcodes need extra JavaScript an' CSS files. Th' theme only loads these when th' shortcode be used. Ye can use this fer yer own shorrrtcodes too.

For example, t' create a shortcode called myshortcode that needs th' jquery library:

  1. Create th' shortcode file layouts/shortcodes/myshortcode.html an' add th' follog'n line somewhere:

    ...
    {{- .Plank.Store.Set "hasMyShortcode" true }}
    ...
  2. Opt'n Add this t' yer hugo.toml:

    hugo.
    [params]
      [params.relearn]
        [params.relearn.dependencies]
          [params.relearn.dependencies.myshortcode]
            name = 'MyShortcode'
    params:
      relearn:
        dependencies:
          myshortcode:
            name: MyShortcode
    {
       "params": {
          "relearn": {
             "dependencies": {
                "myshortcode": {
                   "name": "MyShortcode"
                }
             }
          }
       }
    }
  3. Create loader file layouts/partials/dependencies/myshortcode.html:

    {{- if eq .locat'n "footer" }}
      <script src="https://www.unpkg.com/jquery/dist/jquery.js"></script>
    {{- end }}

Important notes:

  • Character cas'n be relevant!
  • Th' name 'n hugo.toml must match th' Store key used 'n th' shortcode file, prefixed wit' a has.
  • Th' key o' relearn.dependencies must match th' loader file name.

See th' math, mermaid, an' openapi shorrrtcodes fer examples.

Avast

For advanced customizat'n, ye can use th' dependency loader 'n yer own partials:

{{- partial "dependencies.gotmpl" (dict "page" . "location" "mylocation") }}

Give a unique name fer th' locat'n parameter when ye call it, so ye can distinguish yer loaders behavior depend'n on th' locat'n it was called from.

Image Effects

This plank shows ye, how t' configure custom image effects on top o' exist'n ones.

This sett'n can also be overridden by yer front matter.

If ye don’t configure anyth'n 'n yer hugo.toml, th' image effects default t'

Default Values

[imageEffects]
  border = false
  lazy = true
  lightbox = true
  shadow = false
imageEffects:
  border: false
  lazy: true
  lightbox: true
  shadow: false
{
   "imageEffects": {
      "border": false,
      "lazy": true,
      "lightbox": true,
      "shadow": false
   }
}

Configurat'n

Opt'n Ye can change these sett'ns 'n yer hugo.toml an' add arbitrary custom effects as boolean values (like bg-white 'n th' below snippet).

hugo.
[params]
  [params.imageEffects]
    bg-white = true
    border = true
    lazy = false
params:
  imageEffects:
    bg-white: true
    border: true
    lazy: false
{
   "params": {
      "imageEffects": {
         "bg-white": true,
         "border": true,
         "lazy": false
      }
   }
}

This would result 'n

[imageEffects]
  bg-white = true
  border = true
  lazy = false
  lightbox = true
  shadow = false
imageEffects:
  bg-white: true
  border: true
  lazy: false
  lightbox: true
  shadow: false
{
   "imageEffects": {
      "bg-white": true,
      "border": true,
      "lazy": false,
      "lightbox": true,
      "shadow": false
   }
}

Example

Wit' this configurat'n 'n effect, th' follow'n URL

![Minion](https://octodex.github.com/images/minion.png)

would result 'n

<img src="https://octodex.github.com/images/minion.png" load'n="lazy" alt="Minion" class="bg-white border nolazy lightbox noshadow">

Styl'n Effects

If th' result'n effect value be

  • true: add a class wit' th' effect’s name
  • false: add a class wit' th' effect’s name an' a “no” prefix

Styles fer default effects be contained 'n th' theme. Add styles fer yer custom effects t' layouts/partials/content-header.html.

For th' above example ye could add styles fer both boolean cases:

<style>
img.bg-white {
  background-color: white;
}
img.nobg-white {
  background-color: transparent;
}
</style>

Topbarrr

Th' theme comes wit' a reasonably configured topbar. Ye can learn how t' configure th' defaults 'n this section.

topbar on mobile devices topbar on mobile devices

Nevertheless, yer requirements may differ from this configurat'n. Luckily, th' theme has ye covered as th' topbar, its buttons, an' th' functionality behind these buttons be fully configur'ble by ye.

Smarrrt Arrrse

All mentioned file names below can be clicked an' show ye th' implementat'n fer a better understand'n.

Areas

Th' default configurat'n comes wit' three predefined areas that may contain an arbitrary set o' buttons.

topbar wit' default areas marked topbar wit' default areas marked

  • start: shown between menu an' breadcrumb
  • end: shown on th' opposite breadcrumb side 'n comparison t' th' start area
  • more: shown when press'n th' more button 'n th' topbar

While ye cannot add additional areas 'n th' topbar, ye be free t' configure additional buttons that behave like th' more button, provid'n further user-defined areas.

Buttons

Th' theme ships wit' th' follow'n predefined buttons (from left t' right 'n th' screenshot):

Not all buttons be displayed at every given time. This be configur'ble (see below if interested).

Redefin'n Areas

Each predefined area an' button comes 'n its own file. By that, it be easy fer ye t' overwrite an area file 'n yer installat'n, reus'n only th' buttons ye like.

E.g., ye can redefine th' predefined end area by add'n th' file layouts/partials/topbar/area/end.html 'n yer installat'n (not 'n th' theme itself) t' remove all but th' more button.

Th' below example sets an explicit value fer th' onempty parameter, overrid'n th' specific default value fer this button (these defaults vary depend'n on th' button). Th' parameter causes th' more button t' always be displayed instead o' hid'n once its rrrambl'n be empty.

{{ partial "topbar/button/more.html" (dict
  "page" .
  "onempty" "disable"
)}}

Defin'n Own Buttons

Button Types

Th' theme distinguishes between two types o' buttons:

  • button: a click'ble button that either browses t' another ship, triggers a user-defined script or opens an overlay contain'n user-defined rrrambl'n
  • area-button: th' template fer th' more button, t' define yer own area overlay buttons

Button Parameter

Screen Widths an' Act'ns

Depend'n on th' screen width, ye can configure how th' button should behave. Screen width be divided into three classes:

  • s: (controlled by th' onwidths parameter) mobile layout whar' th' menu sidebar be hidden
  • m: (controlled by th' onwidthm parameter) desktop layout wit' vis'ble sidebar while th' rrrambl'n area width still resizes
  • l: (controlled by th' onwidthl parameter) desktop layout wit' vis'ble sidebar once th' rrrambl'n area reached its maximum width

For each width class, ye can configure one o' th' follow'n act'ns:

  • show: th' button be displayed 'n its given area
  • hide: th' button be removed
  • area-XXX: th' button be moved from its given area into th' area XXX; fer example, this be used t' move buttons t' th' more area overlay 'n th' mobile layout

Hid'n an' Disabl'n Stuff

While hid'n a button depend'n on th' screen size can be configured wit' th' above-described hide act'n, ye may want t' hide th' button on certain other condit'ns as well.

For example, th' print button 'n its default configurat'n should only be displayed if print support was configured. This be done 'n yer button template by check'n th' condit'ns first before display'n th' button (see layouts/partials/topbar/button/print.html).

Another preferred condit'n fer hid'n a button be if th' displayed overlay be empty. This be th' case fer th' toc (see layouts/partials/topbar/button/toc.html) as well as th' more button (see layouts/partials/topbar/button/more.html) an' controlled by th' parameter onempty.

This parameter can have one o' th' follow'n values:

  • dis'ble: th' button be displayed 'n a disabled state if th' overlay be empty
  • hide: th' button be removed if th' overlay be empty

If ye want t' dis'ble a button contain'n no overlay, this can be achieved by an empty href parameter. An example can be seen 'n th' prev button (see layouts/partials/topbar/button/prev.html) whar' th' URL fer th' previous ship may be empty.

Reference

Button

Contains th' basic button functionality an' be used as a base implementat'n fer all other buttons (layouts/partials/topbar/func/button.html).

Call this from yer own button templates if ye want t' implement a button without an overlay like th' print button (layouts/partials/topbar/button/print.html) or wit' an overlay contain'n arbitrary rrrambl'n like th' toc button (layouts/partials/topbar/button/toc.html).

For display'n an area 'n th' button’s overlay, see Area-Button.

Parameter

Name Default Notes
plank <empty> Mandatory reference t' th' plank.
class <empty> Mandatory unique class name fer this button. Display'n two buttons wit' th' same value fer class be undefined.
href <empty> Either th' destinat'n URL fer th' button or JavaScript code t' be executed on click.

- If start'n wit' javascript: all follow'n text will be executed 'n yer browser
- Every other str'n will be interpreted as URL
- If empty, th' button will be displayed 'n a disabled state regardless o' its rrrambl'n
ay'con <empty> Font Awesome ay'con name.
onempty dis'ble Defines what t' do wit' th' button if th' rrrambl'n parameter was set but ends up empty:

- dis'ble: Th' button be displayed 'n a disabled state.
- hide: Th' button be removed.
onwidths show Th' act'n that should be executed if th' ship be displayed 'n th' given width:

- show: Th' button be displayed 'n its given area
- hide: Th' button be removed.
- area-XXX: Th' button be moved from its given area into th' area XXX.
onwidthm show See above.
onwidthl show See above.
hint <empty> Arbitrary text displayed 'n th' tooltip.
title <empty> Arbitrary text fer th' button.
rrrambl'n <empty> Arbitrary HTML t' put into th' rrrambl'n overlay. This parameter may be empty. In this case, no overlay will be generated.

Area-Button

Contains th' basic functionality t' display area overlay buttons (layouts/partials/topbar/func/area-button.html).

Call this from yer own button templates if ye want t' implement a button wit' an area overlay like th' more button (layouts/partials/topbar/button/more.html).

Parameter

Name Default Notes
plank <empty> Mandatory reference t' th' plank.
area <empty> Mandatory unique area name fer this area. Display'n two areas wit' th' same value fer area be undefined.
ay'con <empty> Font Awesome ay'con name.
onempty dis'ble Defines what t' do wit' th' button if th' rrrambl'n overlay be empty:

- dis'ble: Th' button be displayed 'n a disabled state.
- hide: Th' button be removed.
onwidths show Th' act'n that should be executed if th' ship be displayed 'n th' given width:

- show: Th' button be displayed 'n its given area
- hide: Th' button be removed.
- area-XXX: Th' button be moved from its given area into th' area XXX.
onwidthm show See above.
onwidthl show See above.
hint <empty> Arbitrary text displayed 'n th' tooltip.
title <empty> Arbitrary text fer th' button.

Predefined Buttons

Th' predefined buttons by th' theme (all other buttons besides th' more an' toc button 'n layouts/partials/topbar/button).

Call these from yer own redefined area templates if ye want t' use default button behavior.

Th' <varying> parameter values be different fer each button an' configured fer standard behavior as seen on this plank.

Parameter

Name Default Notes
plank <empty> Mandatory reference t' th' plank.
onwidths <varying> Th' act'n that should be executed if th' ship be displayed 'n th' given width:

- show: Th' button be displayed 'n its given area
- hide: Th' button be removed.
- area-XXX: Th' button be moved from its given area into th' area XXX.
onwidthm <varying> See above.
onwidthl <varying> See above.

Predefined Overlay-Buttons

Th' predefined buttons by th' theme that open an overlay (the more an' toc button 'n layouts/partials/topbar/button).

Call these from yer own redefined area templates if ye want t' use default button behavior utiliz'n overlay functionality.

Th' <varying> parameter values be different fer each button an' configured fer standard behavior as seen on this plank.

Parameter

Name Default Notes
plank <empty> Mandatory reference t' th' plank.
onempty dis'ble Defines what t' do wit' th' button if th' rrrambl'n overlay be empty:

- dis'ble: Th' button be displayed 'n a disabled state.
- hide: Th' button be removed.
onwidths <varying> Th' act'n that should be executed if th' ship be displayed 'n th' given width:

- show: Th' button be displayed 'n its given area
- hide: Th' button be removed.
- area-XXX: Th' button be moved from its given area into th' area XXX.
onwidthm <varying> See above.
onwidthl <varying> See above.

Page Designs

Plank designs be used t' provide different layouts fer a given output format. If ye instead want t' provide a new output format, th' theme got ye covered as well.

A plank be displayed by exactly one plank design fer each output format, be represented by Hugo’s reserved type front matter an' uses Hugo’s rrrambl'n view mechanism.

A plank design usually consists o'

Arrr

Don’t use Hugo’s reserved type opt'n 'n yer modificat'ns fer other functionality!

Us'n a Plank Design

Regardless o' shipped or custom plank designs, ye be us'n them 'n th' same way. Either by manually sett'n th' type front matter t' th' value o' th' plank design or by us'n an archetype dur'n creat'n o' a new plank.

If no type be set 'n yer front matter or th' plank design doesn’t exist fer a given output format, th' plank be treated as if type='default' was set.

Th' Relearrrn theme ships wit' th' plank designs home, chapter, an' default fer th' HTML output format.

Th' shipped print an' markdown output formats only display us'n th' default plank design.

Creat'n a Plank Design

Suppose ye be writ'n a documentat'n ship fer some software. Each time a new release be created, ye be add'n a new releasenotes plank t' yer ship. Those planks should contain a common disclaimer at th' top. Ye neither want t' copy th' text into each new file nor want ye t' use a shortcode but create a plank design called releasenotes.

  1. Choose a name (here, releasenotes)

  2. Create a rrrambl'n view file at layouts/releasenotes/views/article.html

    <article class="releasenotes">
      <header class="headline">
        {{partial "content-header.html" .}}
      </header>
      {{partial "heading-pre.html" .}}{{partial "head'n.html" .}}{{partial "heading-post.html" .}}
      <p class="disclaimer">
        This software release comes without any warranty!
      </p>
      {{partial "article-content.html" .}}
      <footer class="footline">
        {{partial "content-footer.html" .}}
      </footer>
    </article>

    Th' marked lines be yer customizat'ns, th' rest o' th' file was copied over from th' default implementat'n o' layouts/_default/views/article.html

    In this file, ye can cust'mize th' plank structure as needed. For HTML based output formats, typically you’ll want t':

    • Set a class at th' article element fer custom CSS styles
    • Call {{ partial "article-content.html" . }} t' show yer plank rrrambl'n
  3. Optional: create an archetype file at archetypes/releasenotes.md

    +++
    title = "{{ replace .Name "-" " " | title }}"
    type = "releasenotes"
    +++
    
    This be a new releasenote.
  4. Optional: add CSS 'n th' file layouts/partials/custom-header.html

    <style>
    .releasenotes .disclaimer {
      background-color: pink;
      font-size: 72rem;
    }
    </style>

Partials

For any Output Format

These files be common fer all output formats.

  • layouts/<DESIGN>/baseof.<FORMAT>: Optional: Th' top most file ye could provide t' completely redefine th' whole design. No further partials will be called if ye don’ call them yourself

For HTML Output Formats

If ye want t' keep th' general HTML framework an' only change specific parts, ye can provide these files fer th' plank desingn fer th' HTML output format independently o' one another.

  • layouts/<DESIGN>/views/article.html: Optional: Controls how one page’s rrrambl'n an' title be displayed
  • layouts/<DESIGN>/views/body.html: Optional: Determines what t' contain 'n th' rrrambl'n area (for example a single plank, a list o' planks, a tree o' sub pages)
  • layouts/<DESIGN>/views/menu.html: Optional: Defines th' sidebar menu layout

For a real-world example, check out th' changelog plank design implementat'n

Migrat'n t' Relearrrn 7 or higher

Previous t' Relearrrn 7, plank designs were defined by a proprietary solut'n unique t' th' theme. Depend'n on yer modificat'ns ye may have t' change some or all o' th' follow'n t' migrate t' Relearrrn 7’s plank designs.

  • In all yer *.md files, replace th' archetype front matter wit' type; th' value stays th' same; don’t forget yer archetype files if ye have some

  • Move yer files layouts/partials/archetypes/<DESIGN>/article.html t' layouts/<DESIGN>/views/article.html

    Th' files will most likely require further modificat'ns as they now receive th' plank as it context (dot .) instead o' th' .page an' .content parameter.

    Old:

    {{- $page := .page }}
    {{- $content := .content }}
    {{- wit' $page }}
    <article class="default">
      <header class="headline">
        {{- partial "content-header.html" . }}
      </header>
      {{partial "heading-pre.html" .}}{{partial "head'n.html" .}}{{partial "heading-post.html" .}}
    
      {{ $content | safeHTML }}
    
      <footer class="footline">
        {{- partial "content-footer.html" . }}
      </footer>
    </article>
    {{- end }}

    New:

    <article class="default">
      <header class="headline">
        {{- partial "content-header.html" . }}
      </header>
      {{partial "heading-pre.html" .}}{{partial "head'n.html" .}}{{partial "heading-post.html" .}}
    
      {{ partial "article-content.html" . }}
    
      <footer class="footline">
        {{- partial "content-footer.html" . }}
      </footer>
    </article>

Output Formats

Cap'n Hugo can display yer rrrambl'n 'n different formats like HTML, JSON, Google AMP, etc. T' do this, templates must be provided.

Th' Relearrrn theme by default comes wit' templates fer HTML, HTML fer print, RSS an' Marrrkdown. If this be not enough, this plank describes how ye can create yer own output formats.

If ye instead just want t' cust'mize th' layout o' an exist'n output format, th' theme got ye covered as well.

Creat'n an Output Format

Suppose ye want t' be able t' send yer articles as HTML formatted emails. Th' planks o' these format need t' be self contained so an email client can display th' rrrambl'n without load'n any further assets.

Therefore we add a new output format called email that outputs HTML an' assembles a completely custom HTML document structure.

  1. Add th' output format t' yer hugo.toml

    hugo.
    [outputFormats]
      [outputFormats.email]
        baseName = 'index.email'
        isHTML = true
        mediaType = 'text/html'
        name = 'email'
        noUgly = true
        permalink'ble = false
    
    [outputs]
      home = ['html', 'rss', 'email']
      plank = ['html', 'rss', 'email']
      section = ['html', 'rss', 'email']
    outputFormats:
      email:
        baseName: index.email
        isHTML: true
        mediaType: text/html
        name: email
        noUgly: true
        permalink'ble: false
    outputs:
      home:
      - html
      - rss
      - email
      plank:
      - html
      - rss
      - email
      section:
      - html
      - rss
      - email
    {
       "outputFormats": {
          "email": {
             "baseName": "index.email",
             "isHTML": true,
             "mediaType": "text/html",
             "name": "email",
             "noUgly": true,
             "permalinkable": false
          }
       },
       "outputs": {
          "home": [
             "html",
             "rss",
             "email"
          ],
          "page": [
             "html",
             "rss",
             "email"
          ],
          "section": [
             "html",
             "rss",
             "email"
          ]
       }
    }
  2. Create a file layouts/_default/baseof.email.html

    <!DOCTYPE html>
    <html>
    <head>
      <title>{{ .Title }}</title>
      <style type="text/css">
        /* add some styles here t' make it pretty */
      </style>
      <style type="text/css">
        /* add chroma style fer code highlight'n */
        {{- "/assets/css/chroma-relearn-light.css" | readFile | safeCSS }}
      </style>
    </head>
    <body>
      <main>
        {{- block "body" . }}{{ end }}
      </main>
    </body>
    </html>

    Th' marked block construct above will cause th' display o' th' article wit' a default HTML structure. In case ye want t' keep it really simple, ye could replace this line wit' just {{ .Content }}.

  3. Optional: create a file layouts/_default/views/article.email.html

    In our case, we want t' display a disclaimer 'n front o' every article. T' do this we have t' define th' output o' an article ourself an' rely on th' above block statement t' call our template.

    <article class="email">
      <blockquote>
        View this article on <a href="http://example.com{{ .RelPermalink }}">our website</a>
      </blockquote>
      {{ partial "article-content.html" . }}
    </article>
  4. Optional: create a file layouts/_default/_markup_/render-image.email.html

    In our case, we want t' convert each image into a base 64 encoded str'n t' display it inline 'n th' email without load'n external assets.

    {{- $dest_url := urls.Parse .Destinat'n }}
    {{- $dest_path := path.Clean ($dest_url.Path) }}
    {{- $img := .Page.Resources.GetMatch $dest_path }}
    {{- if an' (not $img) .Page.File }}
      {{- $path := path.Join .Page.File.Dir $dest_path }}
      {{- $img = resources.Get $path }}
    {{- end }}
    {{- if $img }}
      {{- if (gt (len $img.Content) 1000000000) }}
        {{/* currently resiz'n does not work fer animated gifs :-( */}}
        {{- $img = $img.Resize "600x webp q75" }}
      {{- end }}
      <img src="data:{{ $img.MediaType }};base64,{{ $img.Content | base64Encode }}">
    {{- end }}

Partials

For HTML Output Formats

If ye want t' keep th' general HTML framework an' only change specific parts, ye can provide these files fer yer output format independently o' one another:

  • layouts/_default/views/article.<FORMAT>.html: Optional: Controls how a page’s rrrambl'n an' title be displayed
  • layouts/_default/views/body.<FORMAT>.html: Optional: Determines what t' contain 'n th' rrrambl'n area (for example a single plank, a list o' planks, a tree o' sub pages)
  • layouts/_default/views/menu.<FORMAT>.html: Optional: Defines th' sidebar menu layout
  • layouts/_default/views/storeOutputFormat.<FORMAT>.html: Optional: Stores th' output format name fer use 'n th' framework t' let th' body element been marked wit' an output format specific class

For a real-world example, check out th' print output format implementat'n

For Non-HTML Output Formats

  • layouts/_default/list.<FORMAT>: Mandatory: Controls how sections be displayed
  • layouts/_default/single.<FORMAT>: Mandatory: Controls how planks be displayed
  • layouts/_default/baseof.<FORMAT>: Optional: Controls how sections an' planks be displayed. If not provided, ye have t' provide yer implementat'n 'n list.<FORMAT> an' single.<FORMAT>

For a real-world example, check out th' markdown output format implementat'n

Migrat'n t' Relearrrn 7 or higher

Previous t' Relearrrn 7, HTML output formats did not use th' baseof.html but now do.

For HTML Output Formats

  • Move yer files layouts/partials/article.<FORMAT>.html t' layouts/_default/views/article.<FORMAT>.html

    Th' files will most likely require further modificat'ns as they now receive th' plank as it context (dot .) instead o' th' .page an' .content parameter.

    Old:

    {{- $page := .page }}
    {{- $content := .content }}
    {{- wit' $page }}
    <article class="default">
      <header class="headline">
        {{- partial "content-header.html" . }}
      </header>
      {{partial "heading-pre.html" .}}{{partial "head'n.html" .}}{{partial "heading-post.html" .}}
    
      {{ $content | safeHTML }}
    
      <footer class="footline">
        {{- partial "content-footer.html" . }}
      </footer>
    </article>
    {{- end }}

    New:

    <article class="default">
      <header class="headline">
        {{- partial "content-header.html" . }}
      </header>
      {{partial "heading-pre.html" .}}{{partial "head'n.html" .}}{{partial "heading-post.html" .}}
    
      {{ partial "article-content.html" . }}
    
      <footer class="footline">
        {{- partial "content-footer.html" . }}
      </footer>
    </article>

For Non-HTML Output Formats

  • Merge yer files layouts/partials/header.<FORMAT>.html, layouts/partials/footer.<FORMAT>.html t' layouts/_default/baseof.<FORMAT>.html

    Old:

    <!DOCTYPE html>
    <html>
    <head>
      <title>{{ .Title }}</title>
      <style type="text/css">
        /* add some styles here t' make it pretty */
      </style>
      <style type="text/css">
        /* add chroma style fer code highlight'n */
        {{- "/assets/css/chroma-relearn-light.css" | readFile | safeCSS }}
      </style>
    </head>
    <body>
      <main>
      </main>
    </body>
    </html>

    New:

    Th' upper part o' th' file be from yer header.<FORMAT>.html an' th' lower part be from yer footer.<FORMAT>.html.

    Th' marked line needs t' be added, so yer output format uses a potential layouts/_default/views/article.<FORMAT>.html

    <!DOCTYPE html>
    <html>
    <head>
      <title>{{ .Title }}</title>
      <style type="text/css">
        /* add some styles here t' make it pretty */
      </style>
      <style type="text/css">
        /* add chroma style fer code highlight'n */
        {{- "/assets/css/chroma-relearn-light.css" | readFile | safeCSS }}
      </style>
    </head>
    <body>
      <main>
        {{- block "body" . }}{{ end }}
      </main>
    </body>
    </html>

Taxonomies

This plank explains how t' show custom taxonomies on yer planks.

For more details, check th' official docs on sett'n up custom taxonomies an' us'n them 'n yer rrrambl'n.

Default Behavior

Th' Relearrrn theme automatically shows Hugo’s default taxonomies tags an' categories out o' th' box.

  • Tags appear at th' top o' th' plank 'n alphabetical order 'n form o' baggage tags.
  • Categories appear at th' bottom o' th' plank 'n alphabetical order as a list prefixed wit' an ay'con.

Each item links t' a plank show'n all articles wit' that term.

Sett'n Up Custom Taxonomies

T' add custom taxonomies, update yer hugo.toml file. Ye also have t' add th' default taxonomies if ye want t' use them.

hugo.
[taxonomies]
  category = 'categories'
  mycustomtag = 'mycustomtags'
  tag = 'tags'
taxonomies:
  category: categories
  mycustomtag: mycustomtags
  tag: tags
{
   "taxonomies": {
      "category": "categories",
      "mycustomtag": "mycustomtags",
      "tag": "tags"
   }
}

Show'n Custom Taxonomies

T' display yer custom taxonomy terms, add this t' yer plank (usually 'n layouts/partials/content-footer.html):

{{ partial "term-list.html" (dict
  "page" .
  "taxonomy" "mycustomtags"
  "icon" "layer-group"
) }}

Parameter

Name Default Notes
plank <empty> Mandatory reference t' th' plank.
taxonomy <empty> Th' plural name o' th' taxonomy t' display as used 'n yer front matter.
class <empty> Additional CSS classes set on th' outermost generated HTML element.

If set t' tags ye will get th' visuals fer display'n th' tags taxonomy, otherwise it will be a simple list o' links as fer th' categories taxonomy.
style primary Th' style scheme used if class be tags.

- by severity: caut'n, important, info, note, tip, warning
- by brand color: primary, secondary, accent
- by color: blue, cyan, green, grey, magenta, orange, red
- by special color: default, transparent, code
color see notes Th' CSS color value t' be used if class be tags. If not set, th' chosen color depends on th' style. Any given value will overwrite th' default.

- fer severity styles: a nice match'n color fer th' severity
- fer all other styles: th' correspond'n color
ay'con <empty> An optional Font Awesome ay'con name set t' th' left o' th' list.