diff options
Diffstat (limited to 'docs/content/en/functions/resources/ExecuteAsTemplate.md')
-rw-r--r-- | docs/content/en/functions/resources/ExecuteAsTemplate.md | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/docs/content/en/functions/resources/ExecuteAsTemplate.md b/docs/content/en/functions/resources/ExecuteAsTemplate.md index 0c90a03b3..bff83832e 100644 --- a/docs/content/en/functions/resources/ExecuteAsTemplate.md +++ b/docs/content/en/functions/resources/ExecuteAsTemplate.md @@ -3,30 +3,25 @@ title: resources.ExecuteAsTemplate description: Returns a resource created from a Go template, parsed and executed with the given context. categories: [] keywords: [] -action: - aliases: [] - related: - - functions/resources/FromString - returnType: resource.Resource - signatures: [resources.ExecuteAsTemplate TARGETPATH CONTEXT RESOURCE] +params: + functions_and_methods: + aliases: [] + returnType: resource.Resource + signatures: [resources.ExecuteAsTemplate TARGETPATH CONTEXT RESOURCE] --- The `resources.ExecuteAsTemplate` function returns a resource created from a Go template, parsed and executed with the given context, caching the result using the target path as its cache key. Hugo publishes the resource to the target path when you call its [`Publish`], [`Permalink`], or [`RelPermalink`] methods. -[`publish`]: /methods/resource/publish/ -[`permalink`]: /methods/resource/permalink/ -[`relpermalink`]: /methods/resource/relpermalink/ - Let's say you have a CSS file that you wish to populate with values from your site configuration: -{{< code file=assets/css/template.css lang=go-html-template >}} +```go-html-template {file="assets/css/template.css"} body { background-color: {{ site.Params.style.bg_color }}; color: {{ site.Params.style.text_color }}; } -{{< /code >}} +``` And your site configuration contains: @@ -54,9 +49,13 @@ The example above: The result is: -{{< code file=public/css/main.css >}} +```css {file="public/css/main.css"} body { background-color: #fefefe; color: #222; } -{{< /code >}} +``` + +[`publish`]: /methods/resource/publish/ +[`permalink`]: /methods/resource/permalink/ +[`relpermalink`]: /methods/resource/relpermalink/ |