Hugo

How to set the menu item name also for the page itself?

Hello,

I’m currently trying to change the Hugo-Flex theme to be more flexible in translation.

I have the menu items posts, tags, categories and about, the menu item names are changed in my config.toml to the German equivalents Beiträge, Schlagworte, Kategorien and Über. But when I click on one of the menu items it will display the page title with “.Title” so, as an example: It shows “Posts” instead of the German word “Beiträge” that I would like to see there.

How do I accomplish that?

I set the menu item in my config.toml like this:

config.toml
[menu]
  [[menu.nav]]
  name = "Beiträge"
  url = "posts/"
  weight = 2.0

Currently the theme is using the following in heading.html:

heading.html
<header class="Heading">
  <h2 class="Heading-title">
    <a class="Heading-link u-clickable" href="{{ .Permalink }}" rel="bookmark">{{ .Title }}</a>
  </h2>
  {{ with .PublishDate | default nil }}
  <time datetime="{{ .Format "2006-01-02T15:04:05Z07:00" }}">
    {{ .Format "2 January, 2006" }}
  </time>
  {{ end }}
</header>

I hope that some of you can help me with this problem.

Regards,
dataCobra

Hi!

Looking at partials/banner.html everything looks correct. My theme test is working, too.

partialCached is probably the reason for this behaviour, see below.

Have you tried deleting the folder resources in your project root?

Moreover, you can replace

{{ partialCached "banner.html" . }}

with

{{ partial "banner.html" . }}