<linkhref="https://mcshelby.github.io/hugo-theme-relearn/configuration/customization/topbar/index.html"rel="canonical"type="text/html"title="Topbar :: Hugo Relearn Theme">
<linkhref="/hugo-theme-relearn/configuration/customization/topbar/index.xml"rel="alternate"type="application/rss+xml"title="Topbar :: Hugo Relearn Theme">
<p>The theme comes with a reasonably configured topbar. You can learn how to <ahref="/hugo-theme-relearn/authoring/frontmatter/topbar/index.html">configure the defaults in this section</a>.</p>
<p><ahref="#R-image-66d88d959322d6a959e287f30b367c36"class="lightbox-link"><imgalt="topbar on mobile devices"class="bg-white border lazy lightbox noshadow figure-image"loading="lazy"src="/hugo-theme-relearn/configuration/customization/topbar/topbar-closed.png"style=" height: auto; width: auto;"></a>
<ahref="javascript:history.back();"class="lightbox-back"id="R-image-66d88d959322d6a959e287f30b367c36"><imgalt="topbar on mobile devices"class="bg-white border lazy lightbox noshadow lightbox-image"loading="lazy"src="/hugo-theme-relearn/configuration/customization/topbar/topbar-closed.png"></a></p>
<p>Nevertheless, your requirements may differ from this configuration. Luckily, the theme has you covered as the topbar, its buttons, and the functionality behind these buttons are fully configurable by you.</p>
<p><ahref="#R-image-7d6a9604d33d24c40a0ff7b06439c255"class="lightbox-link"><imgalt="topbar with default areas marked"class="bg-white border lazy lightbox noshadow figure-image"loading="lazy"src="/hugo-theme-relearn/configuration/customization/topbar/topbar-areas.png"style=" height: auto; width: auto;"></a>
<ahref="javascript:history.back();"class="lightbox-back"id="R-image-7d6a9604d33d24c40a0ff7b06439c255"><imgalt="topbar with default areas marked"class="bg-white border lazy lightbox noshadow lightbox-image"loading="lazy"src="/hugo-theme-relearn/configuration/customization/topbar/topbar-areas.png"></a></p>
<li><ahref="https://github.com/McShelby/hugo-theme-relearn/blob/main/layouts/partials/topbar/area/start.html"rel="external"target="_self"><strong>start</strong></a>: shown between menu and breadcrumb</li>
<li><ahref="https://github.com/McShelby/hugo-theme-relearn/blob/main/layouts/partials/topbar/area/end.html"rel="external"target="_self"><strong>end</strong></a>: shown on the opposite breadcrumb side in comparison to the <em>start</em> area</li>
<li><ahref="https://github.com/McShelby/hugo-theme-relearn/blob/main/layouts/partials/topbar/area/more.html"rel="external"target="_self"><strong>more</strong></a>: shown when pressing the <spanclass="btn cstyle transparent"><span><iclass="fa-fw fas fa-ellipsis-v"></i></span></span><em>more</em> button in the topbar</li>
<p>While you cannot add additional areas in the topbar, you are free to configure additional buttons that behave like the <em>more</em> button, providing further user-defined areas.</p>
<li><spanclass="btn cstyle transparent"><span><iclass="fa-fw fas fa-bars"></i></span></span><ahref="https://github.com/McShelby/hugo-theme-relearn/blob/main/layouts/partials/topbar/button/sidebar.html"rel="external"target="_self"><strong>sidebar</strong></a>: opens the sidebar flyout if in mobile layout</li>
<li><spanclass="btn cstyle transparent"><span><iclass="fa-fw fas fa-list-alt"></i></span></span><ahref="https://github.com/McShelby/hugo-theme-relearn/blob/main/layouts/partials/topbar/button/toc.html"rel="external"target="_self"><strong>toc</strong></a>: <ahref="/hugo-theme-relearn/authoring/frontmatter/topbar/index.html#table-of-contents">opens the table of contents in an overlay</a></li>
<li><spanclass="btn cstyle transparent"><span><iclass="fa-fw fas fa-pen"></i></span></span><ahref="https://github.com/McShelby/hugo-theme-relearn/blob/main/layouts/partials/topbar/button/edit.html"rel="external"target="_self"><strong>edit</strong></a>: browses to the editable page if the <code>editURL</code><ahref="/hugo-theme-relearn/authoring/frontmatter/topbar/index.html#edit-button">parameter is set</a></li>
<li><spanclass="btn cstyle transparent"><span><iclass="fa-fw fas fa-print"></i></span></span><ahref="https://github.com/McShelby/hugo-theme-relearn/blob/main/layouts/partials/topbar/button/print.html"rel="external"target="_self"><strong>print</strong></a>: browses to the chapter’s printable page if <ahref="/hugo-theme-relearn/configuration/sitemanagement/outputformats/index.html#print-support">print support</a> was activated</li>
<li><spanclass="btn cstyle transparent"><span><iclass="fa-fw fas fa-chevron-left"></i></span></span><ahref="https://github.com/McShelby/hugo-theme-relearn/blob/main/layouts/partials/topbar/button/prev.html"rel="external"target="_self"><strong>prev</strong></a>: browses to the <ahref="/hugo-theme-relearn/authoring/frontmatter/topbar/index.html#arrow-navigation">previous page</a> if there is one</li>
<li><spanclass="btn cstyle transparent"><span><iclass="fa-fw fas fa-chevron-right"></i></span></span><ahref="https://github.com/McShelby/hugo-theme-relearn/blob/main/layouts/partials/topbar/button/next.html"rel="external"target="_self"><strong>next</strong></a>: browses to the [next page]authoring/frontmatter/topbar(#arrow-navigation) if there is one</li>
<li><spanclass="btn cstyle transparent"><span><iclass="fa-fw fas fa-ellipsis-v"></i></span></span><ahref="https://github.com/McShelby/hugo-theme-relearn/blob/main/layouts/partials/topbar/button/more.html"rel="external"target="_self"><strong>more</strong></a>: opens the overlay for the <em>more</em> area</li>
<p>Each predefined area and button comes in its own file. By that, it is easy for you to overwrite an area file in your installation, reusing only the buttons you like.</p>
<p>E.g., you can redefine the predefined <em>end</em> area by adding the file <ahref="https://github.com/McShelby/hugo-theme-relearn/blob/main/layouts/partials/topbar/area/end.html"rel="external"target="_self"><code>layouts/partials/topbar/area/end.html</code></a> in your installation (not in the theme itself) to remove all but the <em>more</em> button.</p>
<p>The below example sets an explicit value for the <code>onempty</code> parameter, overriding the specific default value for this button (these defaults vary depending on the button). The parameter causes the <em>more</em> button to always be displayed instead of hiding once its content is empty.</p>
<li><ahref="/hugo-theme-relearn/configuration/customization/topbar/index.html#button"><strong>button</strong></a>: a clickable button that either browses to another site, triggers a user-defined script or opens an overlay containing user-defined content</li>
<li><ahref="/hugo-theme-relearn/configuration/customization/topbar/index.html#area-button"><strong>area-button</strong></a>: the template for the <spanclass="btn cstyle transparent"><span><iclass="fa-fw fas fa-ellipsis-v"></i></span></span><em>more</em> button, to define your own area overlay buttons</li>
<li><strong>s</strong>: (controlled by the <code>onwidths</code> parameter) mobile layout where the menu sidebar is hidden</li>
<li><strong>m</strong>: (controlled by the <code>onwidthm</code> parameter) desktop layout with visible sidebar while the content area width still resizes</li>
<li><strong>l</strong>: (controlled by the <code>onwidthl</code> parameter) desktop layout with visible sidebar once the content area reached its maximum width</li>
</ul>
<p>For each width class, you can configure one of the following actions:</p>
<li><code>area-XXX</code>: the button is moved from its given area into the area <code>XXX</code>; for example, this is used to move buttons to the <em>more</em> area overlay in the mobile layout</li>
<p>While hiding a button depending on the screen size can be configured with the above-described <em>hide</em> action, you may want to hide the button on certain other conditions as well.</p>
<p>For example, the <em>print</em> button in its default configuration should only be displayed if print support was configured. This is done in your button template by checking the conditions first before displaying the button (see <ahref="https://github.com/McShelby/hugo-theme-relearn/blob/main/layouts/partials/topbar/button/print.html"rel="external"target="_self"><code>layouts/partials/topbar/button/print.html</code></a>).</p>
<p>Another preferred condition for hiding a button is if the displayed overlay is empty. This is the case for the <em>toc</em> (see <ahref="https://github.com/McShelby/hugo-theme-relearn/blob/main/layouts/partials/topbar/button/toc.html"rel="external"target="_self"><code>layouts/partials/topbar/button/toc.html</code></a>) as well as the <em>more</em> button (see <ahref="https://github.com/McShelby/hugo-theme-relearn/blob/main/layouts/partials/topbar/button/more.html"rel="external"target="_self"><code>layouts/partials/topbar/button/more.html</code></a>) and controlled by the parameter <code>onempty</code>.</p>
<p>If you want to disable a button containing <em>no overlay</em>, this can be achieved by an empty <code>href</code> parameter. An example can be seen in the <em>prev</em> button (see <code>layouts/partials/topbar/button/prev.html</code>) where the URL for the previous site may be empty.</p>
<p>Contains the basic button functionality and is used as a base implementation for all other buttons (<ahref="https://github.com/McShelby/hugo-theme-relearn/blob/main/layouts/partials/topbar/func/button.html"rel="external"target="_self"><code>layouts/partials/topbar/func/button.html</code></a>).</p>
<p>Call this from your own button templates if you want to implement a button without an overlay like the <em>print</em> button (<ahref="https://github.com/McShelby/hugo-theme-relearn/blob/main/layouts/partials/topbar/button/print.html"rel="external"target="_self"><code>layouts/partials/topbar/button/print.html</code></a>) or with an overlay containing arbitrary content like the <em>toc</em> button (<ahref="https://github.com/McShelby/hugo-theme-relearn/blob/main/layouts/partials/topbar/button/toc.html"rel="external"target="_self"><code>layouts/partials/topbar/button/toc.html</code></a>).</p>
<p>For displaying an area in the button’s overlay, see <ahref="/hugo-theme-relearn/configuration/customization/topbar/index.html#area-button">Area-Button</a>.</p>
<td>Either the destination URL for the button or JavaScript code to be executed on click.<br><br>- If starting with <code>javascript:</code> all following text will be executed in your browser<br>- Every other string will be interpreted as URL<br>- If empty, the button will be displayed in a disabled state regardless of its <strong>content</strong></td>
<td>Defines what to do with the button if the content parameter was set but ends up empty:<br><br>- <code>disable</code>: The button is displayed in a disabled state.<br>- <code>hide</code>: The button is removed.</td>
<td>The action that should be executed if the site is displayed in the given width:<br><br>- <code>show</code>: The button is displayed in its given area<br>- <code>hide</code>: The button is removed.<br>- <code>area-XXX</code>: The button is moved from its given area into the area <code>XXX</code>.</td>
<p>Contains the basic functionality to display area overlay buttons (<ahref="https://github.com/McShelby/hugo-theme-relearn/blob/main/layouts/partials/topbar/func/area-button.html"rel="external"target="_self"><code>layouts/partials/topbar/func/area-button.html</code></a>).</p>
<p>Call this from your own button templates if you want to implement a button with an area overlay like the <em>more</em> button (<ahref="https://github.com/McShelby/hugo-theme-relearn/blob/main/layouts/partials/topbar/button/more.html"rel="external"target="_self"><code>layouts/partials/topbar/button/more.html</code></a>).</p>
<td>Defines what to do with the button if the content overlay is empty:<br><br>- <code>disable</code>: The button is displayed in a disabled state.<br>- <code>hide</code>: The button is removed.</td>
<td>The action that should be executed if the site is displayed in the given width:<br><br>- <code>show</code>: The button is displayed in its given area<br>- <code>hide</code>: The button is removed.<br>- <code>area-XXX</code>: The button is moved from its given area into the area <code>XXX</code>.</td>
<p>The predefined buttons by the theme (all other buttons besides the <em>more</em> and <em>toc</em> button in <ahref="https://github.com/McShelby/hugo-theme-relearn/blob/main/layouts/partials/topbar/button"rel="external"target="_self"><code>layouts/partials/topbar/button</code></a>).</p>
<td>The action that should be executed if the site is displayed in the given width:<br><br>- <code>show</code>: The button is displayed in its given area<br>- <code>hide</code>: The button is removed.<br>- <code>area-XXX</code>: The button is moved from its given area into the area <code>XXX</code>.</td>
<p>The predefined buttons by the theme that open an overlay (the <em>more</em> and <em>toc</em> button in <ahref="https://github.com/McShelby/hugo-theme-relearn/blob/main/layouts/partials/topbar/button"rel="external"target="_self"><code>layouts/partials/topbar/button</code></a>).</p>
<td>Defines what to do with the button if the content overlay is empty:<br><br>- <code>disable</code>: The button is displayed in a disabled state.<br>- <code>hide</code>: The button is removed.</td>
<td>The action that should be executed if the site is displayed in the given width:<br><br>- <code>show</code>: The button is displayed in its given area<br>- <code>hide</code>: The button is removed.<br>- <code>area-XXX</code>: The button is moved from its given area into the area <code>XXX</code>.</td>