Help modifying Hugo Bearcub theme

Hi peeps!

I am a newcomer to the Hugo ecosystem, and I found myself a nice theme for my personal blog. However, I am a little bit lost in the modifying of theme that suits me.

I would like to present a list of blog posts on my homepage like this: Blog | Bear Cub however I do find it hard to modify the templates (I am absolutely clueless about how to achieve that) and I do find the homepage in the template a bit useless.

Any hints how to modify the theme would be appreciated. Cheers!

The theme’s home page template is:

themes/hugo-bearcub/layouts/index.html

Override the file by copying it to:

layouts/index.html

Then modify it as needed, probably something like this:

layouts/index.html
{{ define "main" }}
  {{ .Content }}
  <ul class="blog-posts">
    {{ range where .Site.RegularPages "Section" "posts" }}
    <li>
      <span>
        <i>
          <time datetime='{{ .Date.Format "2006-01-02" }}' pubdate>
            {{ .Date.Format (default "2006-01-02" .Site.Params.dateFormat) }}
          </time>
        </i>
      </span>
      {{ if .Params.link }}
        <a href="{{ .Params.link }}" target="_blank">{{ .Title }} ↪</a>
      {{ else }}
        <a href="{{ .RelPermalink }}">{{ .Title }}</a>
      {{ end }}
    </li>
    {{ else }}
    <li>
      {{ i18n "no-posts" }}
    </li>
    {{ end }}
  </ul>
{{ end }}

Hey, thanks for the help, that was exactly what I was looking for!

1 Like