gohugoio/hugo · error

permalinks configuration not supported for kind

Error message

permalinks configuration not supported for kind %q, supported kinds are %v

What it means

Thrown by decodePermalinksMap when the legacy map-format permalinks config uses a '[permalinks.<kind>]' sub-section whose <kind> key is not one of the supported page kinds (page, home, section, taxonomy, term). The message lists the allowed kinds.

Solutions

  1. Use only supported kinds as the sub-section key: page, home, section, taxonomy, or term.
  2. If you meant to target a section, put the section under the top-level [permalinks] map (posts = "/:slug/") instead of [permalinks.posts].
  3. Switch to the list format with explicit target.kind/target.path for finer control.

Example fix

# before (invalid)
[permalinks.archive]
posts = "/:year/:slug/"
# after
[permalinks]
posts = "/:year/:slug/"
Defensive patterns

Strategy: validation

Validate before calling

supported := map[string]bool{"page": true, "home": true, "section": true, "taxonomy": true, "term": true}
for k := range m {
    if _, isParams := m[k].(hmaps.Params); isParams && !supported[k] {
        return fmt.Errorf("kind %q not supported", k)
    }
}

Type guard

func isSupportedPermalinkKind(k string) bool {
    for _, s := range []string{"page", "home", "section", "taxonomy", "term"} {
        if s == k { return true }
    }
    return false
}

Try / catch

cfg, err := page.DecodePermalinksConfig(raw)
if err != nil { /* move section keys to top-level [permalinks] */ }

Prevention

When it happens

Trigger: Writing [permalinks.archive] or [permalinks.custom] (a kind Hugo does not support) under the map format, expecting section-style keys but using an invalid kind identifier.

Common situations: Confusing the section-name map format ([permalinks] / posts = ...) with the per-kind map format ([permalinks.<kind>] / ... = ...) and putting an arbitrary string as the kind.

Related errors


AI-assisted analysis of gohugoio/hugo@52c9bd7908 (2026-08-09). Data as JSON: /api/errors/f0544cf9cb5e2407. Report an issue: GitHub.

Appendix: source

Thrown at resources/page/permalinks.go:583

	var configs PermalinksConfig
	config := hmaps.CleanConfigStringMap(m)

	for k, v := range config {
		switch v := v.(type) {
		case string:
			// [permalinks]
			//   key = '...'
			// Backward compat: set for both page and term.
			configs = append(configs,
				PermalinkConfig{Target: PageMatcher{Kind: kinds.KindPage, Path: sectionToPathGlob(k)}, Pattern: v},
				PermalinkConfig{Target: PageMatcher{Kind: kinds.KindTerm, Path: sectionToPathGlob(k)}, Pattern: v},
			)

		case hmaps.Params:
			// [permalinks.kind]
			//   section = '...'
			if !hstrings.InSlice(permalinksKindsSupport, k) {
				return nil, fmt.Errorf("permalinks configuration not supported for kind %q, supported kinds are %v", k, permalinksKindsSupport)
			}
			for k2, v2 := range v {
				switch v2 := v2.(type) {
				case string:
					configs = append(configs,
						PermalinkConfig{Target: PageMatcher{Kind: k, Path: sectionToPathGlob(k2)}, Pattern: v2},
					)
				default:
					return nil, fmt.Errorf("permalinks configuration invalid: unknown value %q for key %q for kind %q", v2, k2, k)
				}
			}

		default:
			return nil, fmt.Errorf("permalinks configuration invalid: unknown value %q for key %q", v, k)
		}
	}
	return configs, nil
}

View on GitHub (pinned to 52c9bd7908)