HUGO
Menu
GitHub 90597 stars Mastodon

resources.Publish

Returns the given resource after publishing it.
Syntax
resources.Publish RESOURCE
Returns
resource.Resource
New in v0.166.0

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.

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 }}