This commit is contained in:
Bjørn Erik Pedersen 2024-06-21 09:41:24 +02:00
commit af0cb57aaf
No known key found for this signature in database
475 changed files with 7408 additions and 4720 deletions

View file

@ -11,33 +11,22 @@ action:
---
```go-html-template
{{ $data := "" }}
{{ $p := "data/books.json" }}
{{ with resources.Get $p }}
{{ $opts := dict "delimiter" "," }}
{{ $data = . | transform.Unmarshal $opts }}
{{ else }}
{{ errorf "Unable to get resource %q" $p }}
{{ end }}
<pre>{{ debug.Dump site.Data.books }}</pre>
```
```go-html-template
<pre>{{ debug.Dump $data }}</pre>
```
```text
[]interface {}{
map[string]interface {}{
```json
[
{
"author": "Victor Hugo",
"rating": 5.0,
"title": "Les Misérables",
"rating": 4,
"title": "The Hunchback of Notre Dame"
},
map[string]interface {}{
{
"author": "Victor Hugo",
"rating": 4.0,
"title": "The Hunchback of Notre Dame",
},
}
"rating": 5,
"title": "Les Misérables"
}
]
```
{{% note %}}