Notes about Hugo

Hugo allows you to get very easy a new theme. Sometimes this new theme have some option you don’t want. For example:In this theme there is by default two additional menus. One for tags, for for categories. That’s something nice.

However, both menu had a very long list, that than needed scrolling bar. The scrolling bar broken than the design of the theme.

My fix for this was disable the two menu for categories and tags. For this I created custom layout pages to overwrite the themes ones. In Hugo there is an order how template documents are rendered.

/layouts/section/SECTION.html
/layouts/_default/section.html
/layouts/_default/list.html
/themes/THEME/layouts/section/SECTION.html
/themes/THEME/layouts/_default/section.html
/themes/THEME/layouts/_default/list.html

As we can see the local folder in /layouts/ are checked first for any template pages to render. Followed by the _default type of a page. Only then comes the template pages of the theme.

So I copied the layout file of the theme to the local /layouts folder. In there I altered the template to not render the menus for categories and tags.

cp themes/code-editor/layouts/partials/menu.html layouts/partials/

The file looks like this now:

<nav class="col-md-3">
    <h3 class="home-link"><a href="/">{{ ( index $.Site.Data.translations $.Site.Params.locale ).root }}</a></h3>
    <div id="last-posts" class="open">
        <h3 data-open="last-posts">{{ .Site.Title }} - {{ ( index $.Site.Data.translations $.Site.Params.locale ).mostrecentposts }}</h3>
        <ul>
            {{ range first 15 .Site.Pages }}
            <li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
            {{ end }}
        </ul>
    </div>
</nav>

Furthermore, I increased the amount of items that are listed from 10 to 15.

so far akendo