Add sections to sidebar

Hello all.

I am a complete newbie to this so I apologise in advance if this is a stupid question.

I am setting up a blog using the “hugo-uno” theme. In the sidebar for this theme I have a “blog” button and a “CV” button. How can I add buttons which link to other pages, for example “Projects” or “Photos”?

Thanks in advance for any help. I am really enjoying Hugo

If you want to list all sections then try this snippet:

{{ range $section, $taxonomy := .Site.Sections }}
    <h4>{{ $section }}</h4>
    <ul>
        {{ range $taxonomy.Pages }}
        <li><a href="{{ .Permalink}}"> {{ .LinkTitle }} </a> </li>
        {{ end }}
    </ul>
{{ end }}

Remove the range loop if you don’t want to list all pages of a section.

Otherwise, you could do it manually with the menu feature.

Hi - thanks for your response. Could I ask you to elaborate a bit further? That code snippet you proveded, exactly where does that go in my Hugo structure? In the config.toml file? Thanks

I think a good start is to start reading up on the main concepts of Hugo in the documentation.

Start here:

As @bep mentioned, it’s a good idea to get familiar with Hugo itself. But to answer your question: I assume that you’re using or created a theme with a sidebar. Each theme usually consists of partials (sub-templates) that you can find under /layouts/partials/. There you need to put the code.

In general, I would recommend you to get familiar with Go’s template language.