Issue Updating Title or Sub-title on Hugo

#1

Hi, I’m very new to static site generators, Hugo being my first. In my templates config.toml file my browsers (I’ve tried multiple) do not show changes of the title/sub-title even after saving, I’ve tried reinstalling Hugo, making sure I have any software required installed (Git, Go) but still no luck. I don’t want to restart my local server every time I make a change. Any help would be greatly appreciated.

Thanks

Max

#2

Please see the Requesting Help topic.

We will need to have a look at your Hugo project’s source code. If possible please share a link to your repository or a ZIP file.

#3

https://expirebox.com/download/f11d6d12ff00de97e91a1b6ff6ee9878.html heres my source code

#4

In your config there are the following parameters:

[params]
  title       = "Here We Go"
  subtitle    = "My Awesome Site Testing Again"

I see the above displayed in your home page. The alt attribute of the logo shows “Here We Go” and the subtitle is directly below.

But your HTML page has no title because in the head partial of the theme you use there are the following:

<title>{{ if .IsHome }}{{ .Title }}{{ else }}{{ .Title }} &middot; {{ .Site.Title }}{{ end }}</title>

To have the title rendered you need to move that title parameter outside the params map.

Like so:

baseurl         = ""
theme           = "casper-two"
languageCode    = "en-US"
disqusShortname = ""
paginate        = 6
#SectionPagesMenu = "main"
title       = "Here We Go"

And then in your header partial change from

<h1 class="site-title">{{ if .Site.Params.logo }}
        <img class="site-logo" src="{{ .Site.Params.logo  | absURL}}" alt="{{ .Site.Params.title }}" />
      {{else}} {{ .Site.Params.title }} {{end}} </h1>

to

<h1 class="site-title">{{ if .Site.Params.logo }}
        <img class="site-logo" src="{{ .Site.Params.logo  | absURL}}" alt="{{ .Site.Title }}" />
      {{else}} {{ .Site.Title }} {{end}} </h1>

The theme you use has an example site. Have a look at it to become familiar with it.

1 Like