mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-15 00:17:29 +00:00
Change transform.Unmarshal remote data examples (#2557)
This commit is contained in:
1 parent
4b79599b9c
commit
b4fc35c3e7
5 files changed
+33
-14
No files matched your search
@@ -101,7 +101,7 @@ my-project/
|
||||
{{ $data := dict }}
|
||||
{{ $p := "data/books.json" }}
|
||||
{{ with resources.Get $p }}
|
||||
{{ $data = .Content | transform.Unmarshal }}
|
||||
{{ $data = . | transform.Unmarshal }}
|
||||
{{ else }}
|
||||
{{ errorf "Unable to get resource %q" $p }}
|
||||
{{ end }}
|
||||
@@ -124,7 +124,7 @@ my-project/
|
||||
{{ $data := dict }}
|
||||
{{ $p := "books.json" }}
|
||||
{{ with .Resources.Get $p }}
|
||||
{{ $data = .Content | transform.Unmarshal }}
|
||||
{{ $data = . | transform.Unmarshal }}
|
||||
{{ else }}
|
||||
{{ errorf "Unable to get resource %q" $p }}
|
||||
{{ end }}
|
||||
@@ -141,7 +141,7 @@ Consider using the [`resources.GetRemote`] function with [`transform.Unmarshal`]
|
||||
{{ with .Err }}
|
||||
{{ errorf "%s" . }}
|
||||
{{ else }}
|
||||
{{ $data = .Content | transform.Unmarshal }}
|
||||
{{ $data = . | transform.Unmarshal }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ errorf "Unable to get remote resource %q" $u }}
|
||||
|
||||
Reference in new issue
Block a user