gohugoio/hugo · error

method .Params is currently not supported in post-publish tr

Error message

method .Params is currently not supported in post-publish transformations.

What it means

Thrown by PostPublishResource.Params() (postpub.go:172-174) because the Params method is intentionally unsupported in the post-publish transformation context. PostPublish resources expose a restricted subset of methods via a field-lookup mechanism; Params is not among them.

Source

Thrown at resources/postpub/postpub.go:173

func (r *PostPublishResource) MediaType() map[string]any {
	m := structToMapWithPlaceholders("MediaType", media.Type{}, r.field)
	return m
}

func (r *PostPublishResource) ResourceType() string {
	return r.field("ResourceType")
}

func (r *PostPublishResource) Name() string {
	return r.field("Name")
}

func (r *PostPublishResource) Title() string {
	return r.field("Title")
}

func (r *PostPublishResource) Params() hmaps.Params {
	panic(r.fieldNotSupported("Params"))
}

func (r *PostPublishResource) Content(context.Context) (any, error) {
	return r.field("Content"), nil
}

func (r *PostPublishResource) fieldNotSupported(name string) string {
	return fmt.Sprintf("method .%s is currently not supported in post-publish transformations.", name)
}

View on GitHub (pinned to 52c9bd7908)

Solutions

  1. Do not call .Params on post-publish resources; access only supported methods (Name, Title, Permalink, MediaType, Content, etc.).
  2. Branch template logic so post-publish resources skip Params access.
  3. If Params data is needed, compute it before the post-publish stage and pass it through a different channel.

Example fix

// before
{{ $pub.Params.author }}
// after
{{ $pub.Title }}
Defensive patterns

Strategy: validation

Validate before calling

{{ if eq (printf "%T" $r) "*postpub.PostPublishResource" }}
  {{/* do not access .Params on post-publish resources */}}
{{ else }}
  {{ $r.Params.foo }}
{{ end }}

Prevention

When it happens

Trigger: Calling .Params on a resource obtained inside a post-publish hook/transformation. The panic message is built by fieldNotSupported to communicate the limitation explicitly.

Common situations: A template partial shared between regular resources and post-publish resources calls .Params; migrating a workflow into post-publish without adjusting accesses.

Related errors


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