resources.Publish
Returns the given resource after publishing it.
- Syntax
- resources.Publish RESOURCE
- Returns
- resource.Resource
Usage
The resources.Publish function writes the given resource to the public directory and returns the resource. Use it to publish a resource within a template pipeline. Outside of a pipeline, you can use the Publish method on the resource instead, which publishes the resource without returning a value.
This works with global resources, page resources, and remote resources.
Examples
Publishing a resource with the resources.Publish function, which returns the resource:
{{ resources.Get "main.js" | js.Build | resources.Publish }}Publishing a resource with the Publish method, which returns nothing:
{{ (resources.Get "main.js" | js.Build).Publish }}Last updated:
November 24, 2026
:
content: Apply style guide to resources functions (1dbb46409)
Improve this page