mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 15:57:57 +00:00
207 lines
21 KiB
HTML
207 lines
21 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en" dir="ltr">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0, minimum-scale=1.0">
|
||
<meta name="generator" content="Hugo 0.119.0">
|
||
<meta name="generator" content="Relearn 5.22.1+tip">
|
||
<meta name="description" content="Documentation for Hugo Relearn Theme">
|
||
<meta name="author" content="Sören Weber">
|
||
<title>Pages organization :: Hugo Relearn Theme</title>
|
||
<link href="https://McShelby.github.io/hugo-theme-relearn/cont/pages/index.html" rel="alternate" hreflang="x-default">
|
||
<link href="https://McShelby.github.io/hugo-theme-relearn/cont/pages/index.html" rel="alternate" hreflang="en">
|
||
<link href="https://McShelby.github.io/hugo-theme-relearn/pir/cont/pages/index.html" rel="alternate" hreflang="pir">
|
||
<link href="https://McShelby.github.io/hugo-theme-relearn/cont/pages/index.html" rel="canonical" type="text/html" title="Pages organization :: Hugo Relearn Theme">
|
||
<link href="../../cont/pages/index.xml" rel="alternate" type="application/rss+xml" title="Pages organization :: Hugo Relearn Theme">
|
||
<link href="../../images/logo.svg?1696881203" rel="icon" type="image/svg+xml">
|
||
<!-- https://github.com/filamentgroup/loadCSS/blob/master/README.md#how-to-use -->
|
||
<link href="../../css/fontawesome-all.min.css?1696881204" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="../../css/fontawesome-all.min.css?1696881204" rel="stylesheet"></noscript>
|
||
<link href="../../css/nucleus.css?1696881204" rel="stylesheet">
|
||
<link href="../../css/auto-complete.css?1696881204" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="../../css/auto-complete.css?1696881204" rel="stylesheet"></noscript>
|
||
<link href="../../css/perfect-scrollbar.min.css?1696881204" rel="stylesheet">
|
||
<link href="../../css/fonts.css?1696881204" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="../../css/fonts.css?1696881204" rel="stylesheet"></noscript>
|
||
<link href="../../css/theme.css?1696881204" rel="stylesheet">
|
||
<link href="../../css/theme-auto.css?1696881204" rel="stylesheet" id="R-variant-style">
|
||
<link href="../../css/variant.css?1696881204" rel="stylesheet">
|
||
<link href="../../css/print.css?1696881204" rel="stylesheet" media="print">
|
||
<link href="../../css/format-print.css?1696881204" rel="stylesheet">
|
||
<link href="../../css/ie.css?1696881204" rel="stylesheet">
|
||
<script src="../../js/url.js?1696881204"></script>
|
||
<script src="../../js/variant.js?1696881204"></script>
|
||
<script>
|
||
// hack to let hugo tell us how to get to the root when using relativeURLs, it needs to be called *url= for it to do its magic:
|
||
// https://github.com/gohugoio/hugo/blob/145b3fcce35fbac25c7033c91c1b7ae6d1179da8/transform/urlreplacers/absurlreplacer.go#L72
|
||
window.index_js_url="../../index.search.js";
|
||
var root_url="../../";
|
||
var baseUri=root_url.replace(/\/$/, '');
|
||
// translations
|
||
window.T_Copy_to_clipboard = 'Copy to clipboard';
|
||
window.T_Copied_to_clipboard = 'Copied to clipboard!';
|
||
window.T_Copy_link_to_clipboard = 'Copy link to clipboard';
|
||
window.T_Link_copied_to_clipboard = 'Copied link to clipboard!';
|
||
window.T_Reset_view = 'Reset view';
|
||
window.T_View_reset = 'View reset!';
|
||
window.T_No_results_found = 'No results found for \u0022{0}\u0022';
|
||
window.T_N_results_found = '{1} results found for \u0022{0}\u0022';
|
||
// some further base stuff
|
||
var baseUriFull='https:\/\/McShelby.github.io\/hugo-theme-relearn/';
|
||
window.variants && variants.init( [ 'auto', 'relearn-bright', 'relearn-light', 'relearn-dark', 'zen-light', 'zen-dark', 'neon', 'learn', 'blue', 'green', 'red' ] );
|
||
</script>
|
||
<style>
|
||
#R-body img.bg-white {
|
||
background-color: white;
|
||
}
|
||
</style>
|
||
</head>
|
||
<body class="mobile-support print disableInlineCopyToClipboard" data-url="../../cont/pages/index.html">
|
||
<div id="R-body" class="default-animation">
|
||
<div id="R-body-overlay"></div>
|
||
<nav id="R-topbar">
|
||
<div class="topbar-wrapper">
|
||
<div class="topbar-sidebar-divider"></div>
|
||
<div class="topbar-area topbar-area-start" data-area="start">
|
||
<div class="topbar-button topbar-button-sidebar" data-content-empty="disable" data-width-s="show" data-width-m="hide" data-width-l="hide">
|
||
<button class="topbar-control" onclick="toggleNav()" type="button" title="Menu (CTRL+ALT+n)">
|
||
<i class="fa-fw fas fa-bars"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<ol class="topbar-breadcrumbs breadcrumbs highlightable" itemscope itemtype="http://schema.org/BreadcrumbList"><li
|
||
itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement"><a itemprop="item" href="../../cont/index.html"><span itemprop="name">Content</span></a><meta itemprop="position" content="1"> > </li><li
|
||
itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement"><span itemprop="name">Pages organization</span><meta itemprop="position" content="2"></li>
|
||
</ol>
|
||
<div class="topbar-area topbar-area-end" data-area="end">
|
||
</div>
|
||
</div>
|
||
</nav>
|
||
<div id="R-main-overlay"></div>
|
||
<main id="R-body-inner" class="highlightable default" tabindex="-1">
|
||
<div class="flex-block-wrapper">
|
||
<article class="default">
|
||
<header class="headline">
|
||
</header>
|
||
<h1 id="pages-organization">Pages organization</h1>
|
||
|
||
<p>In <strong>Hugo</strong>, pages are the core of your site. Once it is configured, pages are definitely the added value to your documentation site.</p>
|
||
<h2 id="folders">Folders</h2>
|
||
<p>Organize your site like <a href="https://gohugo.io/content/organization/" target="_blank">any other Hugo project</a>. Typically, you will have a <em>content</em> folder with all your pages.</p>
|
||
<div class="wrap-code highlight"><pre tabindex="0" class="chroma"><code class="language-plaintext" data-lang="plaintext"><span class="line"><span class="cl">content
|
||
</span></span><span class="line"><span class="cl">├── level-one
|
||
</span></span><span class="line"><span class="cl">│ ├── level-two
|
||
</span></span><span class="line"><span class="cl">│ │ ├── level-three
|
||
</span></span><span class="line"><span class="cl">│ │ │ ├── level-four
|
||
</span></span><span class="line"><span class="cl">│ │ │ │ ├── _index.md <-- /level-one/level-two/level-three/level-four
|
||
</span></span><span class="line"><span class="cl">│ │ │ │ ├── page-4-a.md <-- /level-one/level-two/level-three/level-four/page-4-a
|
||
</span></span><span class="line"><span class="cl">│ │ │ │ ├── page-4-b.md <-- /level-one/level-two/level-three/level-four/page-4-b
|
||
</span></span><span class="line"><span class="cl">│ │ │ │ └── page-4-c.md <-- /level-one/level-two/level-three/level-four/page-4-c
|
||
</span></span><span class="line"><span class="cl">│ │ │ ├── _index.md <-- /level-one/level-two/level-three
|
||
</span></span><span class="line"><span class="cl">│ │ │ ├── page-3-a.md <-- /level-one/level-two/level-three/page-3-a
|
||
</span></span><span class="line"><span class="cl">│ │ │ ├── page-3-b.md <-- /level-one/level-two/level-three/page-3-b
|
||
</span></span><span class="line"><span class="cl">│ │ │ └── page-3-c.md <-- /level-one/level-two/level-three/page-3-c
|
||
</span></span><span class="line"><span class="cl">│ │ ├── _index.md <-- /level-one/level-two
|
||
</span></span><span class="line"><span class="cl">│ │ ├── page-2-a.md <-- /level-one/level-two/page-2-a
|
||
</span></span><span class="line"><span class="cl">│ │ ├── page-2-b.md <-- /level-one/level-two/page-2-b
|
||
</span></span><span class="line"><span class="cl">│ │ └── page-2-c.md <-- /level-one/level-two/page-2-c
|
||
</span></span><span class="line"><span class="cl">│ ├── _index.md <-- /level-one
|
||
</span></span><span class="line"><span class="cl">│ ├── page-1-a.md <-- /level-one/page-1-a
|
||
</span></span><span class="line"><span class="cl">│ ├── page-1-b.md <-- /level-one/page-1-b
|
||
</span></span><span class="line"><span class="cl">│ └── page-1-c.md <-- /level-one/page-1-c
|
||
</span></span><span class="line"><span class="cl">├── _index.md <-- /
|
||
</span></span><span class="line"><span class="cl">└── page-top.md <-- /page-top</span></span></code></pre></div>
|
||
<div class="box notices cstyle note">
|
||
<div class="box-label"><i class="fa-fw fas fa-exclamation-circle"></i> Note</div>
|
||
<div class="box-content">
|
||
|
||
<p><code>_index.md</code> is required in each folder, it’s your “folder home page”</p>
|
||
</div>
|
||
</div>
|
||
<h2 id="create-your-project">Create your project</h2>
|
||
<p>The following steps are here to help you initialize your new website. If you don’t know Hugo at all, we strongly suggest you to train by following <a href="https://gohugo.io/overview/quickstart/" target="_blank">great documentation for beginners</a>.</p>
|
||
<p>Hugo provides a <code>new</code> command to create a new website.</p>
|
||
<div class="wrap-code highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">hugo new site <new_project></span></span></code></pre></div><p>The Relearn theme provides <a href="../../cont/archetypes/">archetypes</a> to help you create this kind of pages.</p>
|
||
<h2 id="frontmatter-configuration">Frontmatter Configuration</h2>
|
||
<p>Each Hugo page has to define a <a href="https://gohugo.io/content/front-matter/" target="_blank">frontmatter</a> in <em>toml</em>, <em>yaml</em> or <em>json</em>. This site will use <em>toml</em> in all cases.</p>
|
||
<p>The Relearn theme uses the following parameters on top of Hugo ones:</p>
|
||
<div class="wrap-code highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="err">+++</span>
|
||
</span></span><span class="line"><span class="cl"><span class="c"># Table of contents (toc) is enabled by default. Set this parameter to true to disable it.</span>
|
||
</span></span><span class="line"><span class="cl"><span class="c"># Note: Toc is always disabled for chapter pages</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">disableToc</span> <span class="p">=</span> <span class="kc">false</span>
|
||
</span></span><span class="line"><span class="cl"><span class="c"># If set, this will be used for the page's menu entry (instead of the `title` attribute)</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">menuTitle</span> <span class="p">=</span> <span class="s2">""</span>
|
||
</span></span><span class="line"><span class="cl"><span class="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><span class="line"><span class="cl"><span class="nx">collapsibleMenu</span> <span class="p">=</span> <span class="kc">false</span>
|
||
</span></span><span class="line"><span class="cl"><span class="c"># If set, this will explicitly override common rules for the expand state of a page's menu entry</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">alwaysopen</span> <span class="p">=</span> <span class="kc">true</span>
|
||
</span></span><span class="line"><span class="cl"><span class="c"># If set, this will explicitly override common rules for the sorting order of a page's submenu entries</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">ordersectionsby</span> <span class="p">=</span> <span class="s2">"title"</span>
|
||
</span></span><span class="line"><span class="cl"><span class="c"># The title of the page heading will be prefixed by this HTML content</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">headingPre</span> <span class="p">=</span> <span class="s2">""</span>
|
||
</span></span><span class="line"><span class="cl"><span class="c"># The title of the page heading will be postfixed by this HTML content</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">headingPost</span> <span class="p">=</span> <span class="s2">""</span>
|
||
</span></span><span class="line"><span class="cl"><span class="c"># The title of the page in menu will be prefixed by this HTML content</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">menuPre</span> <span class="p">=</span> <span class="s2">""</span>
|
||
</span></span><span class="line"><span class="cl"><span class="c"># The title of the page in menu will be postfixed by this HTML content</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">menuPost</span> <span class="p">=</span> <span class="s2">""</span>
|
||
</span></span><span class="line"><span class="cl"><span class="c"># Hide a menu entry by setting this to true</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">hidden</span> <span class="p">=</span> <span class="kc">false</span>
|
||
</span></span><span class="line"><span class="cl"><span class="c"># Display name of this page modifier. If set, it will be displayed in the footer.</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">LastModifierDisplayName</span> <span class="p">=</span> <span class="s2">""</span>
|
||
</span></span><span class="line"><span class="cl"><span class="c"># Email of this page modifier. If set with LastModifierDisplayName, it will be displayed in the footer</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">LastModifierEmail</span> <span class="p">=</span> <span class="s2">""</span>
|
||
</span></span><span class="line"><span class="cl"><span class="c"># Override default values for image effects, you can even add your own arbitrary effects to the list</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">[</span><span class="nx">params</span><span class="p">.</span><span class="nx">imageEffects</span><span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nx">border</span> <span class="p">=</span> <span class="kc">false</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nx">lightbox</span> <span class="p">=</span> <span class="kc">true</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nx">shadow</span> <span class="p">=</span> <span class="kc">false</span>
|
||
</span></span><span class="line"><span class="cl"><span class="err">+++</span></span></span></code></pre></div><h3 id="add-icon-to-a-menu-entry">Add icon to a menu entry</h3>
|
||
<p>In the page frontmatter, add a <code>menuPre</code> param to insert any HTML code before the menu label. The example below uses the GitHub icon.</p>
|
||
<div class="wrap-code highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="err">+++</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">title</span> <span class="p">=</span> <span class="s2">"GitHub repo"</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">menuPre</span> <span class="p">=</span> <span class="s2">"<i class='fab fa-github'></i> "</span>
|
||
</span></span><span class="line"><span class="cl"><span class="err">+++</span></span></span></code></pre></div><p><a href="#R-image-c5f5fd0375c1a76baf3a3ec6821d8223" class="lightbox-link"><img src="../../cont/pages/frontmatter-icon.png?width=18.75rem" alt="Title with icon" class="figure-image bg-white border lightbox noshadow" style="height: auto; width: 18.75rem;" loading="lazy"></a>
|
||
<a href="javascript:history.back();" class="lightbox-back" id="R-image-c5f5fd0375c1a76baf3a3ec6821d8223"><img src="../../cont/pages/frontmatter-icon.png?width=18.75rem" alt="Title with icon" class="lightbox-image bg-white border lightbox noshadow" loading="lazy"></a></p>
|
||
<h3 id="ordering-sibling-menupage-entries">Ordering sibling menu/page entries</h3>
|
||
<p>Hugo provides a <a href="https://gohugo.io/content/ordering/" target="_blank">flexible way</a> to handle order for your pages.</p>
|
||
<p>The simplest way is to set <code>weight</code> parameter to a number.</p>
|
||
<div class="wrap-code highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="err">+++</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">title</span> <span class="p">=</span> <span class="s2">"My page"</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">weight</span> <span class="p">=</span> <span class="mi">5</span>
|
||
</span></span><span class="line"><span class="cl"><span class="err">+++</span></span></span></code></pre></div><h3 id="using-a-custom-title-for-menu-entries">Using a custom title for menu entries</h3>
|
||
<p>By default, the Relearn theme will use a page’s <code>title</code> attribute for the menu item (or <code>linkTitle</code> if defined).</p>
|
||
<p>But a page’s title has to be descriptive on its own while the menu is a hierarchy.
|
||
We’ve added the <code>menuTitle</code> parameter for that purpose:</p>
|
||
<p>For example (for a page named <code>content/install/linux.md</code>):</p>
|
||
<div class="wrap-code highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="err">+++</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">title</span> <span class="p">=</span> <span class="s2">"Install on Linux"</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">menuTitle</span> <span class="p">=</span> <span class="s2">"Linux"</span>
|
||
</span></span><span class="line"><span class="cl"><span class="err">+++</span></span></span></code></pre></div><h3 id="override-expand-state-rules-for-menu-entries">Override expand state rules for menu entries</h3>
|
||
<p>You can change how the theme expands menu entries on the side of the content with the <code>alwaysopen</code> setting on a per page basis. If <code>alwaysopen=false</code> for any given entry, its children will not be shown in the menu as long as it is not necessary for the sake of navigation.</p>
|
||
<p>The theme generates the menu based on the following rules:</p>
|
||
<ul>
|
||
<li>all parent entries of the active page including their siblings are shown regardless of any settings</li>
|
||
<li>immediate children entries of the active page are shown regardless of any settings</li>
|
||
<li>if not overridden, all other first level entries behave like they would have been given <code>alwaysopen=false</code></li>
|
||
<li>if not overridden, all other entries of levels besides the first behave like they would have been given <code>alwaysopen=true</code></li>
|
||
<li>all visible entries show their immediate children entries if <code>alwaysopen=true</code>; this proceeds recursively</li>
|
||
<li>all remaining entries are not shown</li>
|
||
</ul>
|
||
<p>You can see this feature in action on the example page for <a href="../../shortcodes/children/">children shortcode</a> and its children pages.</p>
|
||
<h2 id="disable-section-pages">Disable Section Pages</h2>
|
||
<p>You may want to structure your pages in a hierachical way but don’t want to generate pages for those sections? The theme got you covered.</p>
|
||
<p>To stay with the initial example: Suppose you want <code>level-one</code> appear in the sidebar but don’t want to generate a page for it. So the entry in the sidebar should not be clickable but should show an expander.</p>
|
||
<p>For this, open <code>content/level-one/_index.md</code> and add the following frontmatter</p>
|
||
<div class="wrap-code highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="nx">collapsibleMenu</span> <span class="p">=</span> <span class="kc">true</span> <span class="c"># this adds the expander to the menu entry if not already set in your config.toml</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">[</span><span class="nx">_build</span><span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nx">render</span> <span class="p">=</span> <span class="s2">"never"</span> <span class="c"># no page will be generated so the page does not have a url</span></span></span></code></pre></div>
|
||
<footer class="footline">
|
||
</footer>
|
||
</article>
|
||
|
||
</div>
|
||
</main>
|
||
</div>
|
||
<script src="../../js/clipboard.min.js?1696881205" defer></script>
|
||
<script src="../../js/perfect-scrollbar.min.js?1696881205" defer></script>
|
||
<script src="../../js/theme.js?1696881205" defer></script>
|
||
</body>
|
||
</html>
|