Changing taxonomy term page title

How can I change the title (Title variable in template) for a taxonomy term page?

I have tried with setting title in a, but I cannot get it to work.

My code is here: GitHub - mikaelstaldal/tech-blog: Mikael Ståldal's technical blog

and I want to change the title of month archive pages like /2023/10 to be something more pretty than “2023/10” as it is now.

I am trying migrate a WordPress blog to Hugo: current blog is here.

$ hugo env
hugo v0.119.0-b84644c008e0dc2c4b67bd69cccf87a41a03937e+extended linux/amd64 BuildDate=2023-09-24T15:20:17Z VendorInfo=snap:0.119.0

What is full path of the that you tried to create?


like this sample

I tried to create /content/month/2023/10/, but it does not work.

And I want to change the title of all terms in this taxonomy, so creating an for each of them would be cumbersome.

I was inspired by this: How to Generate Chronological Blog Archives in Hugo?

I don’t see any config files in your repo … (or I missed it?)

Looked ia a post, you should get generated directories like

public/categories/java etc…

then you need a content/categories/java/ file

There is a search function for the DOCs :wink:

Read the taxonomy template doc … can help to understand Hugo better


Here is the config file:

You need to override the Ananke theme’s site-header partial.

mkdir layouts/partials
cp themes/ananke/layouts/partials/site-header.html layouts/partials/

Then replace this:

{{ .Title | default .Site.Title }}

With something like:

{{ $title := or .Title .Site.Title }}
{{ if and (eq .Kind "term") (eq .Data.Singular "month") }}
  {{ $y := index (split .Data.Term "/") 0 }}
  {{ $m := index (split .Data.Term "/") 1 }}
  {{ $t := time.AsTime (printf "%s-%s-01" $y $m) }}
  {{ $title = time.Format "Articles from Jan 2006" $t }}
{{ end }}
{{ $title }}

In the above, since $t is a time.Time value, you can use whatever format string you’d like.

Thanks, that works.

Would be nice to be able to override what title is passed to the theme’s template though, but maybe that’s not possible?

In this case, it’s not possible.

I am open to suggestion on better ways to achieve WordPress compatible monthly archives.

Can the published page exist only at:

Or do you also need:

To forward to:

And if it forwards, which of the two URLs is canonical? I assume the latter.

I only need, is not necessary.

(It seems like I only have in my current Hugo setup.)

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.