List custom taxonomy terms in a specific order (not alphabetical)

Here’s a summary of @Korka13’s solution with the slightly simpler use case of needing to list terms in a custom order of only one taxonomy, in case it helps anyone doing this for the first time as I was.

My content is “projects”, with each project belonging to one “gallery”.

In /config.yaml:

taxonomies:
  gallery: galleries

Project content

/content/projects/soho/index.md:

---
title: "Soho"
galleries:
  - Kitchens
---

Taxonomy pages

/content/galleries/kitchens/index.md:

---
title: "Kitchens"
weight: 10
---

/content/galleries/commercial/index.md:

---
title: "Commercial"
weight: 20
---

Template

{{ $galleries := $.Site.GetPage "galleries" }}

<ul>
	{{ range $galleries.Pages.ByWeight -}}
		<li>
			<a href="{{ .RelPermalink }}" class="{{ .Title | urlize }}'">
				{{ .Title }}
			</a>
		</li>
	{{ end }}
</ul>