mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
Merge commit '8d9511a08f14260cbfb73119e4afae50e5a9966d'
This commit is contained in:
@@ -60,7 +60,22 @@ RelPermalink
|
||||
: The relative URL to the resource. Resources of type `page` will have no value.
|
||||
|
||||
Content
|
||||
: The content of the resource itself. For most resources, this returns a string with the contents of the file. This can be used to inline some resources, such as `<script>{{ (.Resources.GetMatch "myscript.js").Content | safeJS }}</script>` or `<img src="{{ (.Resources.GetMatch "mylogo.png").Content | base64Encode }}">`.
|
||||
: The content of the resource itself. For most resources, this returns a string
|
||||
with the contents of the file. Use this to create inline resources.
|
||||
|
||||
```go-html-template
|
||||
{{ with .Resources.GetMatch "script.js" }}
|
||||
<script>{{ .Content | safeJS }}</script>
|
||||
{{ end }}
|
||||
|
||||
{{ with .Resources.GetMatch "style.css" }}
|
||||
<style>{{ .Content | safeCSS }}</style>
|
||||
{{ end }}
|
||||
|
||||
{{ with .Resources.GetMatch "img.png" }}
|
||||
<img src="data:{{ .MediaType }};base64,{{ .Content | base64Encode }}">
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
MediaType
|
||||
: The MIME type of the resource, such as `image/jpeg`.
|
||||
|
Reference in New Issue
Block a user