<linkhref="https://McShelby.github.io/hugo-theme-relearn/basics/configuration/index.html"rel="canonical"type="text/html"title="Configuration :: Hugo Relearn Theme">
<p>On top of <ahref="https://gohugo.io/overview/configuration/"target="_blank">Hugo global configuration</a>, the Relearn theme lets you define the following parameters in your <code>config.toml</code> (here, values are default).</p>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># This controls whether submenus will be expanded (true), or collapsed (false) in the</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># menu; if no setting is given, the first menu level is set to false, all others to true;</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># this can be overridden in the pages frontmatter</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># Prefix URL to edit current page. Will display an "Edit" button on top right hand corner of every page.</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># Useful to give opportunity to people to create merge request for your doc.</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># See the config.toml file from this documentation site to have an example.</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># Disables hidden pages from showing up in the sitemap and on Google (et all), otherwise they may be indexed by search engines</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># Disables hidden pages from showing up on the tags page although the tag term will be displayed even if all pages are hidden</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># Javascript and CSS cache are automatically busted when new version of site is generated.</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># Set this to true to disable this behavior (some proxies don't handle well this optimization)</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># Set this to true if you want to disable generation for generator version meta tags of hugo and the theme;</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># don't forget to also set Hugo's disableHugoGeneratorInject=true, otherwise it will generate a meta tag into your home page</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># Set this to true to disable the hover effect for copy-to-clipboard buttons for block code.</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># A title for shortcuts in menu is set by default. Set this to true to disable it.</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># If set to false, a Home button will appear below the search bar on the menu.</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># It is redirecting to the landing page of the current language if specified. (Default is "/")</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># If set to false, load the MathJax module on every page regardless if a MathJax shortcode is present</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># If set to false, load the Mermaid module on every page regardless if a Mermaid shortcode or Mermaid codefence is present</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># If set to false, load the OpenAPI module on every page regardless if a OpenAPI shortcode is present</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># Order sections in menu by "weight" or "title". Default to "weight";</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># this can be overridden in the pages frontmatter</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># Change default color scheme with a variant one. Eg. can be "auto", "red", "blue", "green" or an array like [ "blue", "green" ].</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># 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 browsers</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># If set to true, no index.html will be appended to prettyURLs; this will cause pages not</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># to be servable from the file system</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># 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 menu</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="c"># Override default values for image effects, you can even add your own arbitrary effects to the list</span>
</span></span><spanclass="line"><spanclass="cl"><spanclass="nx">shadow</span><spanclass="p">=</span><spanclass="kc">false</span></span></span></code></pre></div><h2id="serving-your-page-from-a-subfolder">Serving your page from a subfolder</h2>
<p>If your site is served from a subfolder, eg. <code>https://example.com/mysite/</code>, you have to set the following lines to your <code>config.toml</code></p>
</span></span><spanclass="line"><spanclass="cl"><spanclass="nx">relativeURLs</span><spanclass="p">=</span><spanclass="kc">true</span></span></span></code></pre></div><p>Without <code>canonifyURLs=true</code> URLs in sublemental pages (like <code>sitemap.xml</code>, <code>rss.xml</code>) will be generated falsly while your HTML files will still work. See <ahref="https://github.com/gohugoio/hugo/issues/5226"target="_blank">https://github.com/gohugoio/hugo/issues/5226</a>.</p>
<h2id="serving-your-page-from-the-filesystem">Serving your page from the filesystem</h2>
<p>If you want your page served from the filesystem by using URLs starting with <code>file://</code> you’ll need the following configuration in your <code>config.toml</code>:</p>
<divclass="wrap-code highlight"><pretabindex="0"class="chroma"><codeclass="language-toml"data-lang="toml"><spanclass="line"><spanclass="cl"><spanclass="nx">relativeURLs</span><spanclass="p">=</span><spanclass="kc">true</span></span></span></code></pre></div><p>The theme will append an additional <code>index.html</code> to all branch bundle links by default to make the page be servable from the file system. If you don’t care about the file system and only serve your page via a webserver you can also generate the links without this change by adding this to your <code>config.toml</code></p>
<p>If you want to use the search feature from the file system using an older installation of the theme make sure to change your outputformat for the homepage from the now deprecated <code>JSON</code> to <code>SEARCH</code><ahref="#activate-search">as seen below</a>.</p>
</span></span><spanclass="line"><spanclass="cl"><spanclass="nx">home</span><spanclass="p">=</span><spanclass="p">[</span><spanclass="s2">"HTML"</span><spanclass="p">,</span><spanclass="s2">"RSS"</span><spanclass="p">,</span><spanclass="s2">"SEARCH"</span><spanclass="p">]</span></span></span></code></pre></div><p>This will generate a search index file at the root of your public folder ready to be consumed by the Lunr search library. Note that the <code>SEARCH</code> outputformat was named <code>JSON</code> in previous releases but was implemented differently. Although <code>JSON</code> still works, it is now deprecated.</p>
<p>You can add a dedicated search page for your page by adding the <code>SEARCHPAGE</code> outputformat to your home page by adding the following lines in your <code>config.toml</code> file. This will cause Hugo to generate a new file <code>http://example.com/mysite/search.html</code>.</p>
</span></span><spanclass="line"><spanclass="cl"><spanclass="nx">home</span><spanclass="p">=</span><spanclass="p">[</span><spanclass="s2">"HTML"</span><spanclass="p">,</span><spanclass="s2">"RSS"</span><spanclass="p">,</span><spanclass="s2">"SEARCH"</span><spanclass="p">,</span><spanclass="s2">"SEARCHPAGE"</span><spanclass="p">]</span></span></span></code></pre></div><p>You can access this page by either clicking on the magnifier glass or by typing some search term and pressing <code>ENTER</code> inside of the menu’s search box .</p>
<p><ahref="#R-image-7da654315b576110248fed431a41f2b2"class="lightbox-link"><imgsrc="../../basics/configuration/search_page.png?&width=60pc"alt="Screenshot of the dedicated search page"class="figure-image bg-white border lightbox noshadow"style="height: auto; width: 60pc;"loading="lazy"></a>
<ahref="javascript:history.back();"class="lightbox-back"id="R-image-7da654315b576110248fed431a41f2b2"><imgsrc="../../basics/configuration/search_page.png?&width=60pc"alt="Screenshot of the dedicated search page"class="lightbox-image bg-white border lightbox noshadow"loading="lazy"></a></p>
<p>To have Hugo create the dedicated search page successfully, you must not generate the URL <code>http://example.com/mysite/search.html</code> from your own content. This can happen if you set <code>uglyURLs=true</code> in your <code>config.toml</code> and defining a Markdown file <code>content/search.md</code>.</p>
<p>To make sure, there is no duplicate content for any given URL of your project, run <code>hugo --printPathWarnings</code>.</p>
<p>You can activate print support to add the capability to print whole chapters or even the complete site. Just add the <code>PRINT</code> output format to your home, section and page in your <code>config.toml</code> as seen below:</p>
</span></span><spanclass="line"><spanclass="cl"><spanclass="nx">page</span><spanclass="p">=</span><spanclass="p">[</span><spanclass="s2">"HTML"</span><spanclass="p">,</span><spanclass="s2">"RSS"</span><spanclass="p">,</span><spanclass="s2">"PRINT"</span><spanclass="p">]</span></span></span></code></pre></div><p>This will add a little printer icon in the top bar. It will switch the page to print preview when clicked. You can then send this page to the printer by using your browser’s usual print functionality.</p>
<p>The resulting URL will not be <ahref="https://gohugo.io/templates/output-formats/#configure-output-formats"target="_blank">configured ugly</a> in terms of <ahref="https://gohugo.io/content-management/urls/#ugly-urls"target="_blank">Hugo’s URL handling</a> even if you’ve set <code>uglyURLs=true</code> in your <code>config.toml</code>. This is due to the fact that for one mime type only one suffix can be configured.</p>
<p>Nevertheless, if you’re unhappy with the resulting URLs you can manually redefine <code>outputFormats.PRINT</code> in your own <code>config.toml</code> to your liking.</p>
<p>The MathJax configuration parameters can also be set on a specific page. In this case, the global parameter would be overwritten by the local one. See <ahref="../../shortcodes/math/">Math</a> for additional documentation.</p>
<p>MathJax is globally disabled. By default it won’t be loaded by any page.</p>
<p>On page “Physics” you coded some JavaScript for a dynamic formulae. You can set the MathJax parameters locally to load mathJax on this page.</p>
<p>You also can disable MathJax for specific pages while globally enabled.</p>
<p>The Mermaid configuration parameters can also be set on a specific page. In this case, the global parameter would be overwritten by the local one. See <ahref="../../shortcodes/mermaid/">Mermaid</a> for additional documentation.</p>
<p>Mermaid is globally disabled. By default it won’t be loaded by any page.</p>
<p>On page “Architecture” you coded some JavaScript to dynamically generate a class diagram. You can set the Mermaid parameters locally to load mermaid on this page.</p>
</span></span><spanclass="line"><spanclass="cl"><spanclass="p">...</span></span></span></code></pre></div><p>If those params are not configured for a specific language, they will get their
<divclass="wrap-code highlight"><pretabindex="0"class="chroma"><codeclass="language-toml"data-lang="toml"><spanclass="line"><spanclass="cl"><spanclass="nx">landingPageName</span><spanclass="p">=</span><spanclass="s2">"<i class='fas fa-home'></i> Home"</span></span></span></code></pre></div><p>The home button is going to look like this:</p>
<p><ahref="#R-image-cd82d49a2aca3fddb2052f15fdbcf747"class="lightbox-link"><imgsrc="../../basics/configuration/home_button_defaults.png?width=18.75rem"alt="Default Home Button"class="figure-image bg-white border lightbox noshadow"style="height: auto; width: 18.75rem;"loading="lazy"></a>
<ahref="javascript:history.back();"class="lightbox-back"id="R-image-cd82d49a2aca3fddb2052f15fdbcf747"><imgsrc="../../basics/configuration/home_button_defaults.png?width=18.75rem"alt="Default Home Button"class="lightbox-image bg-white border lightbox noshadow"loading="lazy"></a></p>
<h2id="social-media-meta-tags">Social Media Meta Tags</h2>
<p>You can add social media meta tags for the <ahref="https://gohugo.io/templates/internal/#open-graph"target="_blank">Open Graph</a> and <ahref="https://gohugo.io/templates/internal/#twitter-cards"target="_blank">Twitter Cards</a> to your site. These are configured as mentioned in the Hugo docs.</p>