diff --git a/content/en/functions/data/GetCSV.md b/content/en/functions/data/GetCSV.md index bd5562229..141ec6c72 100644 --- a/content/en/functions/data/GetCSV.md +++ b/content/en/functions/data/GetCSV.md @@ -93,7 +93,7 @@ my-project/ ``` ```go-html-template -{{ $data := "" }} +{{ $data := dict }} {{ $p := "data/pets.csv" }} {{ with resources.Get $p }} {{ $opts := dict "delimiter" "," }} @@ -117,7 +117,7 @@ my-project/ ``` ```go-html-template -{{ $data := "" }} +{{ $data := dict }} {{ $p := "pets.csv" }} {{ with .Resources.Get $p }} {{ $opts := dict "delimiter" "," }} @@ -132,7 +132,7 @@ my-project/ Consider using the [`resources.GetRemote`] function with [`transform.Unmarshal`] when accessing a remote resource to improve error handling and cache control. ```go-html-template -{{ $data := "" }} +{{ $data := dict }} {{ $u := "https://example.org/pets.csv" }} {{ with resources.GetRemote $u }} {{ with .Err }} diff --git a/content/en/functions/data/GetJSON.md b/content/en/functions/data/GetJSON.md index f2ad34021..1a661c38b 100644 --- a/content/en/functions/data/GetJSON.md +++ b/content/en/functions/data/GetJSON.md @@ -98,7 +98,7 @@ my-project/ ``` ```go-html-template -{{ $data := "" }} +{{ $data := dict }} {{ $p := "data/books.json" }} {{ with resources.Get $p }} {{ $data = .Content | transform.Unmarshal }} @@ -121,7 +121,7 @@ my-project/ ``` ```go-html-template -{{ $data := "" }} +{{ $data := dict }} {{ $p := "books.json" }} {{ with .Resources.Get $p }} {{ $data = .Content | transform.Unmarshal }} @@ -135,7 +135,7 @@ my-project/ Consider using the [`resources.GetRemote`] function with [`transform.Unmarshal`] when accessing a remote resource to improve error handling and cache control. ```go-html-template -{{ $data := "" }} +{{ $data := dict }} {{ $u := "https://example.org/books.json" }} {{ with resources.GetRemote $u }} {{ with .Err }} diff --git a/content/en/functions/debug/Dump.md b/content/en/functions/debug/Dump.md index b77642b69..ed549c081 100644 --- a/content/en/functions/debug/Dump.md +++ b/content/en/functions/debug/Dump.md @@ -11,7 +11,7 @@ action: --- ```go-html-template -{{ $data := "" }} +{{ $data := dict }} {{ $p := "data/books.json" }} {{ with resources.Get $p }} {{ $opts := dict "delimiter" "," }} diff --git a/content/en/functions/resources/GetRemote.md b/content/en/functions/resources/GetRemote.md index 5336042e6..d140797ac 100644 --- a/content/en/functions/resources/GetRemote.md +++ b/content/en/functions/resources/GetRemote.md @@ -73,7 +73,7 @@ When retrieving remote data, use the [`transform.Unmarshal`] function to [unmars [unmarshal]: /getting-started/glossary/#unmarshal ```go-html-template -{{ $data := "" }} +{{ $data := dict }} {{ $url := "https://example.org/books.json" }} {{ with resources.GetRemote $url }} {{ with .Err }} diff --git a/content/en/functions/transform/Unmarshal.md b/content/en/functions/transform/Unmarshal.md index 85f7cd740..70a12097e 100644 --- a/content/en/functions/transform/Unmarshal.md +++ b/content/en/functions/transform/Unmarshal.md @@ -46,10 +46,10 @@ assets/ ``` ```go-html-template -{{ $data := "" }} +{{ $data := dict }} {{ $path := "data/books.json" }} {{ with resources.Get $path }} - {{ with unmarshal .Content }} + {{ with .Content | transform.Unmarshal }} {{ $data = . }} {{ end }} {{ else }} @@ -75,10 +75,10 @@ content/ ``` ```go-html-template -{{ $data := "" }} +{{ $data := dict }} {{ $path := "books.json" }} {{ with .Resources.Get $path }} - {{ with unmarshal .Content }} + {{ with .Content | transform.Unmarshal }} {{ $data = . }} {{ end }} {{ else }} @@ -95,7 +95,7 @@ content/ A remote resource is a file on a remote server, accessible via HTTP or HTTPS. ```go-html-template -{{ $data := "" }} +{{ $data := dict }} {{ $url := "https://example.org/books.json" }} {{ with resources.GetRemote $url }} {{ with .Err }} @@ -166,7 +166,7 @@ When unmarshaling an XML file, do not include the root node when accessing data. Get the remote data: ```go-html-template -{{ $data := "" }} +{{ $data := dict }} {{ $url := "https://example.org/books/index.xml" }} {{ with resources.GetRemote $url }} {{ with .Err }}