Subsct'ns o' Site Management

Directory Structure

If you’ve followed th' Gett'n Started guide, yer directory layout will look similar t' this:

β”œβ”€β”€ rrrambl'n
β”‚   β”œβ”€β”€ first-chapter
β”‚   β”‚   β”œβ”€β”€ first-page
|   |   |   └── _index.md
β”‚   β”‚   β”œβ”€β”€ second-page
|   |   |   └── index.md
β”‚   β”‚   └── third-page.md
β”‚   └── _index.md
β”œβ”€β”€ themes
β”‚   └── hugo-theme-relearn
β”‚       └── ...
└── hugo.toml

Cap'n Hugo uses a union file system, which lets ye combine multiple directories.

By default, it puts yer root directory on top o' th' Relearrrn theme directory. Files 'n yer root directory will replace theme files 'n th' same locat'n.

For example, if ye create a file at layouts/partials/head'n.html, it will override th' theme’s themes/hugo-theme-relearn/layouts/partials/head'n.html.

See this list, t' learn which files be allowed t' be modified by ye.

This makes it easy t' cust'mize th' theme without chang'n files 'n th' themes directory, mak'n future theme updates simpler.

Arrr

Don’t edit files inside th' themes/hugo-theme-relearn directory. That’s not th' recommended way t' cust'mize! Refer t' th' explanat'n above.

Don’t clone th' theme repository an' edit files there fer yer ship. That’s not th' recommended way t' cust'mize! Instead, follow th' Gett'n Started guide.

Multilingual

Th' Relearrrn theme works wit' Hugo’s multilingual mode.

It supports many languages, includ'n right-to-left languages.

  • Arabic
  • Simplified Chinese
  • Traditional Chinese
  • Czech
  • Dutch
  • English
  • Finnish
  • French
  • German
  • Hindi
  • Hungarian
  • Indonesian
  • Italian
  • Japanese
  • Korean
  • Polish
  • Portuguese
  • Romanian
  • Russian
  • Spanish
  • Swahili
  • Turkish
  • Vietnamese

Translat'n by File Name

Here’s how t' make yer ship multilingual us'n translat'ns by file name:

  1. Set up languages 'n yer hugo.toml file:

    hugo.
    defaultContentLanguage = 'en'
    
    [languages]
      [languages.en]
        languageCode = 'en'
        languageName = 'English'
        title = 'My Website'
        weight = 1
    
      [languages.pir]
        languageCode = 'art-x-pir'
        languageDirect'n = 'rtl'
        languageName = 'Pirrratish'
        title = 'Arrr, my Website'
        weight = 2
    defaultContentLanguage: en
    languages:
      en:
        languageCode: en
        languageName: English
        title: My Website
        weight: 1
      pir:
        languageCode: art-x-pir
        languageDirect'n: rtl
        languageName: Pirrratish
        title: Arrr, my Website
        weight: 2
    {
       "defaultContentLanguage": "en",
       "languages": {
          "en": {
             "languageCode": "en",
             "languageName": "English",
             "title": "My Website",
             "weight": 1
          },
          "pir": {
             "languageCode": "art-x-pir",
             "languageDirection": "rtl",
             "languageName": "Pirrratish",
             "title": "Arrr, my Website",
             "weight": 2
          }
       }
    }
  2. Duplicate yer rrrambl'n files an' add language codes t' their file names:

    β”œβ”€β”€ rrrambl'n
    β”‚   β”œβ”€β”€ first-chapter
    β”‚   β”‚   β”œβ”€β”€ first-page
    |   |   |   β”œβ”€β”€ _index.en.md
    |   |   |   └── _index.pir.md
    β”‚   β”‚   β”œβ”€β”€ second-page
    |   |   |   β”œβ”€β”€ index.en.md
    |   |   |   └── index.pir.md
    β”‚   β”‚   β”œβ”€β”€ third-page.en.md
    β”‚   β”‚   └── third-page.pir.md
    β”‚   β”œβ”€β”€ _index.en.md
    β”‚   └── _index.pir.md
    β”œβ”€β”€ themes
    β”‚   └── hugo-theme-relearn
    β”‚       └── ...
    └── hugo.toml

Translat'n by Rrrambl'n Directory

Th' theme also support translat'ns by rrrambl'n directory which can be configured 'n a similar way. This be not used 'n further examples o' this documentat'n.

Search Sett'ns

Check th' search configurat'n fer multilingual opt'ns.

Turn Off Language Switch'n

Opt'n By default th' theme shows a language switcher 'n th' lower part o' th' menu.

T' dis'ble th' language switcher set disableLanguageSwitchingButton=true

hugo.
[params]
  disableLanguageSwitchingButton = true
params:
  disableLanguageSwitchingButton: true
{
   "params": {
      "disableLanguageSwitchingButton": true
   }
}

Meta Information

Ship Author Informat'n

Opt'n Th' theme uses author details 'n various parts o' yer ship, like RSS feeds an' meta tags.

hugo.
[params]
  [params.author]
    email = 'santa@example.com'
    name = 'Santa Claus'
params:
  author:
    email: santa@example.com
    name: Santa Claus
{
   "params": {
      "author": {
         "email": "santa@example.com",
         "name": "Santa Claus"
      }
   }
}

Ship Title

Th' title will be used 'n meta informat'n o' yer HTML.

hugo.
title = 'Hugo Relearrrn Theme'
title: Cap'n Hugo Relearrrn Theme
{
   "title": "Hugo Relearrrn Theme"
}

Ship Descript'n

Front Matter Th' theme shows a ship descript'n 'n various places, such as RSS feeds an' meta tags. For this, it uses th' descript'n field from yer home page’s front matter.

Social Media Images

When yer plank be shared on social media, ye can set a site-wide image t' display wit' th' link

hugo.
images = ['images/hero.png']
images:
- images/hero.png
{
   "images": [
      "images/hero.png"
   ]
}

More Social Media Opt'ns

Th' theme adheres t' Hugo’s official documentat'n fer Open Graph an' Twitter Cards configurat'n.

Deployment Scenarios

Offline Usage

Th' theme be us'ble offline. No internet connect'n be required t' board yer plank. This be achieved by stor'n all dependencies within th' theme.

No calls t' 3rd party servers, no call'n home, no track'n. Privacy friendly.

Server Deployment

If yer server deployment has no special requirements, ye can skip this section an' use th' standard Cap'n Hugo opt'ns.

For special requirements, th' theme be cap'ble o' different scenarios, requir'n th' follow'n mandatory sett'ns 'n yer hugo.toml. All sett'ns not mentioned 'n th' examples below can be set t' yer lik'n.

Public Web Server from Root

hugo.
baseURL = 'https://example.com/'
baseURL: https://example.com/
{
   "baseURL": "https://example.com/"
}

Public Web Server from Subdirectory

hugo.
baseURL = 'https://example.com/mysite/'
relativeURLs = false
baseURL: https://example.com/mysite/
relativeURLs: false
{
   "baseURL": "https://example.com/mysite/",
   "relativeURLs": false
}

If ye be still us'n Hugo’s relref shortcode (which ye shouldn’t), ye will need further configurat'n.

Arrr

Don’t use a baseURL wit' a subdirectory an' relativeURLs=true together. Cap'n Hugo doesn’t apply th' baseURL correctly 'n this case. If ye need both, generate yer ship twice wit' different sett'ns into separate directories.

Private Web Server (LAN)

Th' same sett'ns as wit' any o' th' public web server scenarios or

hugo.
baseURL = '/'
relativeURLs = true
baseURL: /
relativeURLs: true
{
   "baseURL": "/",
   "relativeURLs": true
}

File System

Yer generated ship can be used headless without a HTTP server.

This can be achieved by us'n th' file:// protocol 'n yer browser’s address bar or by do'ble click on a generated *.html file 'n yer file navigat'n tool.

Use th' follow'n sett'ns

hugo.
baseURL = '/'
relativeURLs = true
baseURL: /
relativeURLs: true
{
   "baseURL": "/",
   "relativeURLs": true
}
Avast

Planks like sitemap.xml an' rss.xml, an' social media links will always use absolute URLs. They won’t work wit' relativeURLs=true.

Available Output Formats

En'ble print support t' print entire chapters or th' whole ship. Add th' print output format t' yer home, section, an' plank 'n hugo.toml:

hugo.
[outputs]
  home = ['html', 'rss', 'print']
  plank = ['html', 'rss', 'print']
  section = ['html', 'rss', 'print']
outputs:
  home:
  - html
  - rss
  - print
  plank:
  - html
  - rss
  - print
  section:
  - html
  - rss
  - print
{
   "outputs": {
      "home": [
         "html",
         "rss",
         "print"
      ],
      "page": [
         "html",
         "rss",
         "print"
      ],
      "section": [
         "html",
         "rss",
         "print"
      ]
   }
}

This adds a printer ay'con 'n th' topbar. Click'n it switches t' print preview, show'n th' plank an' its vis'ble subpages 'n a printer-friendly format. Use yer browser’s print funct'n t' print or save as PDF.

Th' URL won’t be configured ugly fer Hugo’s URL handl'n, even wit' uglyURLs=true 'n hugo.toml. This be because each mime type can only have one suffix.

If ye don’t like th' URLs, ye can reconfigure outputFormats.print 'n yer hugo.toml t' someth'n other than th' default o':

hugo.
[outputFormats]
  [outputFormats.print]
    baseName = 'index.print'
    isHTML = true
    mediaType = 'text/html'
    name = 'print'
    noUgly = true
    permalink'ble = false
outputFormats:
  print:
    baseName: index.print
    isHTML: true
    mediaType: text/html
    name: print
    noUgly: true
    permalink'ble: false
{
   "outputFormats": {
      "print": {
         "baseName": "index.print",
         "isHTML": true,
         "mediaType": "text/html",
         "name": "print",
         "noUgly": true,
         "permalinkable": false
      }
   }
}

Stable Output

Disabl'n th' Generator Meta

Opt'n Th' theme adds a meta tag wit' its version number t' each plank.

This isn’t a security risk an' helps us support ye better.

T' turn this off, set disableGeneratorVersion=true.

hugo.
[params]
  disableGeneratorVersion = true
params:
  disableGeneratorVersion: true
{
   "params": {
      "disableGeneratorVersion": true
   }
}

If ye also want t' turn off Hugo’s version meta tag, use disableHugoGeneratorInject=true.

Disabl'n IDs fer Referenced Assets

Opt'n Th' theme creates a unique ID fer each build an' adds it t' each referenced asset’s URL t' make browsers not keep outdated cached assets.

This be bloody fer product'n sites but can be problematic dur'n development. It makes compar'n outputs difficult as each build has new IDs.

T' dis'ble this, set disableAssetsBusting=true.

hugo.
[params]
  disableAssetsBust'n = true
params:
  disableAssetsBust'n: true
{
   "params": {
      "disableAssetsBusting": true
   }
}

Disabl'n IDs fer Interactive HTML Elements

Opt'n Features like expanders, callouts, an' tabs use unique IDs t' work. These IDs change wit' each build.

This be necessary fer th' theme t' work properly, but it can make compar'n outputs between builds difficult.

T' turn this off, set disableRandomIds=true. Avast, that this will result 'n a non-functional ship!.

hugo.
[params]
  disableRandomIds = true
params:
  disableRandomIds: true
{
   "params": {
      "disableRandomIds": true
   }
}