{"record":{"id":"304346ae5253417f","repo":"gohugoio/hugo","slug":"method-params-is-currently-not-supported-in-post","errorCode":null,"errorMessage":"method .Params is currently not supported in post-publish transformations.","messagePattern":"method \\.Params is currently not supported in post-publish transformations\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"resources/postpub/postpub.go","lineNumber":173,"sourceCode":"func (r *PostPublishResource) MediaType() map[string]any {\n\tm := structToMapWithPlaceholders(\"MediaType\", media.Type{}, r.field)\n\treturn m\n}\n\nfunc (r *PostPublishResource) ResourceType() string {\n\treturn r.field(\"ResourceType\")\n}\n\nfunc (r *PostPublishResource) Name() string {\n\treturn r.field(\"Name\")\n}\n\nfunc (r *PostPublishResource) Title() string {\n\treturn r.field(\"Title\")\n}\n\nfunc (r *PostPublishResource) Params() hmaps.Params {\n\tpanic(r.fieldNotSupported(\"Params\"))\n}\n\nfunc (r *PostPublishResource) Content(context.Context) (any, error) {\n\treturn r.field(\"Content\"), nil\n}\n\nfunc (r *PostPublishResource) fieldNotSupported(name string) string {\n\treturn fmt.Sprintf(\"method .%s is currently not supported in post-publish transformations.\", name)\n}\n","sourceCodeStart":155,"sourceCodeEnd":183,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/resources/postpub/postpub.go#L155-L183","documentation":"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.","triggerScenarios":"Calling .Params on a resource obtained inside a post-publish hook/transformation. The panic message is built by fieldNotSupported to communicate the limitation explicitly.","commonSituations":"A template partial shared between regular resources and post-publish resources calls .Params; migrating a workflow into post-publish without adjusting accesses.","solutions":["Do not call .Params on post-publish resources; access only supported methods (Name, Title, Permalink, MediaType, Content, etc.).","Branch template logic so post-publish resources skip Params access.","If Params data is needed, compute it before the post-publish stage and pass it through a different channel."],"exampleFix":"// before\n{{ $pub.Params.author }}\n// after\n{{ $pub.Title }}","handlingStrategy":"validation","validationCode":"{{ if eq (printf \"%T\" $r) \"*postpub.PostPublishResource\" }}\n  {{/* do not access .Params on post-publish resources */}}\n{{ else }}\n  {{ $r.Params.foo }}\n{{ end }}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid shared partials that call .Params across regular and post-publish resources.","Document the supported method subset for post-publish resources.","Carry required front matter through a non-Params channel in post-publish flows."],"tags":["post-publish","resource","unsupported-method","hugo"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}