diff options
Diffstat (limited to 'docs/content/en/functions/data')
-rw-r--r-- | docs/content/en/functions/data/GetCSV.md | 28 | ||||
-rw-r--r-- | docs/content/en/functions/data/GetJSON.md | 28 |
2 files changed, 40 insertions, 16 deletions
diff --git a/docs/content/en/functions/data/GetCSV.md b/docs/content/en/functions/data/GetCSV.md index d61ea791d..c35d48f67 100644 --- a/docs/content/en/functions/data/GetCSV.md +++ b/docs/content/en/functions/data/GetCSV.md @@ -15,6 +15,18 @@ action: toc: true --- +{{% deprecated-in 0.123.0 %}} +Instead, use [`transform.Unmarshal`] with a [global], [page], or [remote] resource. + +See the [remote data example]. + +[`transform.Unmarshal`]: /functions/transform/unmarshal/ +[global]: /getting-started/glossary/#global-resource +[page]: /getting-started/glossary/#page-resource +[remote data example]: /functions/resources/getremote/#remote-data +[remote]: /getting-started/glossary/#remote-resource +{{% /deprecated-in %}} + Given the following directory structure: ```text @@ -31,7 +43,7 @@ Access the data with either of the following: ``` {{% note %}} -When working with local data, the filepath is relative to the working directory. +When working with local data, the file path is relative to the working directory. You must not place CSV files in the project's data directory. {{% /note %}} @@ -81,7 +93,7 @@ my-project/ ``` ```go-html-template -{{ $data := "" }} +{{ $data := dict }} {{ $p := "data/pets.csv" }} {{ with resources.Get $p }} {{ $opts := dict "delimiter" "," }} @@ -105,7 +117,7 @@ my-project/ ``` ```go-html-template -{{ $data := "" }} +{{ $data := dict }} {{ $p := "pets.csv" }} {{ with .Resources.Get $p }} {{ $opts := dict "delimiter" "," }} @@ -120,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 }} @@ -134,7 +146,7 @@ Consider using the [`resources.GetRemote`] function with [`transform.Unmarshal`] {{ end }} ``` -[`Resources.Get`]: methods/page/Resources -[`resources.GetRemote`]: /functions/resources/getremote -[`resources.Get`]: /functions/resources/get -[`transform.Unmarshal`]: /functions/transform/unmarshal +[`Resources.Get`]: /methods/page/resources/ +[`resources.GetRemote`]: /functions/resources/getremote/ +[`resources.Get`]: /functions/resources/get/ +[`transform.Unmarshal`]: /functions/transform/unmarshal/ diff --git a/docs/content/en/functions/data/GetJSON.md b/docs/content/en/functions/data/GetJSON.md index 4db3c8988..348021226 100644 --- a/docs/content/en/functions/data/GetJSON.md +++ b/docs/content/en/functions/data/GetJSON.md @@ -15,6 +15,18 @@ action: toc: true --- +{{% deprecated-in 0.123.0 %}} +Instead, use [`transform.Unmarshal`] with a [global], [page], or [remote] resource. + +See the [remote data example]. + +[`transform.Unmarshal`]: /functions/transform/unmarshal/ +[global]: /getting-started/glossary/#global-resource +[page]: /getting-started/glossary/#page-resource +[remote data example]: /functions/resources/getremote/#remote-data +[remote]: /getting-started/glossary/#remote-resource +{{% /deprecated-in %}} + Given the following directory structure: ```text @@ -31,7 +43,7 @@ Access the data with either of the following: ``` {{% note %}} -When working with local data, the filepath is relative to the working directory. +When working with local data, the file path is relative to the working directory. {{% /note %}} Access remote data with either of the following: @@ -86,7 +98,7 @@ my-project/ ``` ```go-html-template -{{ $data := "" }} +{{ $data := dict }} {{ $p := "data/books.json" }} {{ with resources.Get $p }} {{ $data = . | transform.Unmarshal }} @@ -109,7 +121,7 @@ my-project/ ``` ```go-html-template -{{ $data := "" }} +{{ $data := dict }} {{ $p := "books.json" }} {{ with .Resources.Get $p }} {{ $data = . | transform.Unmarshal }} @@ -123,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 }} @@ -136,7 +148,7 @@ Consider using the [`resources.GetRemote`] function with [`transform.Unmarshal`] {{ end }} ``` -[`Resources.Get`]: methods/page/Resources -[`resources.GetRemote`]: /functions/resources/getremote -[`resources.Get`]: /functions/resources/get -[`transform.Unmarshal`]: /functions/transform/unmarshal +[`Resources.Get`]: /methods/page/resources/ +[`resources.GetRemote`]: /functions/resources/getremote/ +[`resources.Get`]: /functions/resources/get/ +[`transform.Unmarshal`]: /functions/transform/unmarshal/ |