Theme mainroad: how to hide posts in the main page?

Hi there,

I would like to show at the main page of my website a standard text with a picture and link about our working group. But the functionality with recent posts I would like to keep also at the sidebar. In general is there such a possibility to realize that?

Thanks in advance


Generally speaking, we need some more info to be able to help you, so please have a look at Requesting Help and provide some more details like your repo etc, ok?

Regarding just having some text on the home page, yes, no problem. See:

You can put that standard text into the content section of, then in the template reference it via {{ .Content }}.

As for the sidebar list, yes, that’s also no problem. See:

The basic concept is to use range:

  <h1>Recent Posts</h1>
  {{- range first 5 .Site.Pages -}}
      <li><a href="{{.RelPermalink}}">{{.Title}}</a></li>
  {{- end -}}

You just have to work that into the template that builds your sidebar.

In “mainroad” theme, which I have never used, looks like it is generating that home page list here:

You’d need to edit that.

The sidebar is controlled by:

Main basic structure is:

Hey Rick, I ve just added my repo into github.

There you can have a look into the code, but unfortunately one can not open the mainroad theme ??? Did I do something wrong?

You can fork the theme if you want to edit it directly, or, you can copy its files you intend to change, to your project folders, and they will override the theme ones when Hugo does the building.

1 Like

Ok I will try to do that. A general question: Do you advice to use a theme? or to construct a page by your own? Which way is easier. I dont have so much time and until the end of the year the new web page should be ready.

@Sibel – Rick has given helpful info for customizing an existing theme.

If you wish to create a layout (or theme) from scratch, checkout the HTML/CSS links in the recommended reading (if needed), then checkout the hugo docs on layouts/templates.