mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-14 20:17:17 +00:00
Fix data.GetJSON examples
This commit is contained in:
1 parent
9029ee1237
commit
9e4d03a79b
1 file changed
+3
-6
@@ -89,8 +89,7 @@ my-project/
|
|||||||
{{ $data := "" }}
|
{{ $data := "" }}
|
||||||
{{ $p := "data/books.json" }}
|
{{ $p := "data/books.json" }}
|
||||||
{{ with resources.Get $p }}
|
{{ with resources.Get $p }}
|
||||||
{{ $opts := dict "delimiter" "," }}
|
{{ $data = . | transform.Unmarshal }}
|
||||||
{{ $data = . | transform.Unmarshal $opts }}
|
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ errorf "Unable to get resource %q" $p }}
|
{{ errorf "Unable to get resource %q" $p }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
@@ -113,8 +112,7 @@ my-project/
|
|||||||
{{ $data := "" }}
|
{{ $data := "" }}
|
||||||
{{ $p := "books.json" }}
|
{{ $p := "books.json" }}
|
||||||
{{ with .Resources.Get $p }}
|
{{ with .Resources.Get $p }}
|
||||||
{{ $opts := dict "delimiter" "," }}
|
{{ $data = . | transform.Unmarshal }}
|
||||||
{{ $data = . | transform.Unmarshal $opts }}
|
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ errorf "Unable to get resource %q" $p }}
|
{{ errorf "Unable to get resource %q" $p }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
@@ -131,8 +129,7 @@ Consider using the [`resources.GetRemote`] function with [`transform.Unmarshal`]
|
|||||||
{{ with .Err }}
|
{{ with .Err }}
|
||||||
{{ errorf "%s" . }}
|
{{ errorf "%s" . }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ $opts := dict "delimiter" "," }}
|
{{ $data = . | transform.Unmarshal }}
|
||||||
{{ $data = . | transform.Unmarshal $opts }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ errorf "Unable to get remote resource %q" $u }}
|
{{ errorf "Unable to get remote resource %q" $u }}
|
||||||
|
|||||||
Reference in new issue
Block a user