mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-14 04:14:42 -04:00
Fix default data type
This commit is contained in:
parent
61319af7ad
commit
b276bb17f2
@ -93,7 +93,7 @@ my-project/
|
|||||||
```
|
```
|
||||||
|
|
||||||
```go-html-template
|
```go-html-template
|
||||||
{{ $data := "" }}
|
{{ $data := dict }}
|
||||||
{{ $p := "data/pets.csv" }}
|
{{ $p := "data/pets.csv" }}
|
||||||
{{ with resources.Get $p }}
|
{{ with resources.Get $p }}
|
||||||
{{ $opts := dict "delimiter" "," }}
|
{{ $opts := dict "delimiter" "," }}
|
||||||
@ -117,7 +117,7 @@ my-project/
|
|||||||
```
|
```
|
||||||
|
|
||||||
```go-html-template
|
```go-html-template
|
||||||
{{ $data := "" }}
|
{{ $data := dict }}
|
||||||
{{ $p := "pets.csv" }}
|
{{ $p := "pets.csv" }}
|
||||||
{{ with .Resources.Get $p }}
|
{{ with .Resources.Get $p }}
|
||||||
{{ $opts := dict "delimiter" "," }}
|
{{ $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.
|
Consider using the [`resources.GetRemote`] function with [`transform.Unmarshal`] when accessing a remote resource to improve error handling and cache control.
|
||||||
|
|
||||||
```go-html-template
|
```go-html-template
|
||||||
{{ $data := "" }}
|
{{ $data := dict }}
|
||||||
{{ $u := "https://example.org/pets.csv" }}
|
{{ $u := "https://example.org/pets.csv" }}
|
||||||
{{ with resources.GetRemote $u }}
|
{{ with resources.GetRemote $u }}
|
||||||
{{ with .Err }}
|
{{ with .Err }}
|
||||||
|
@ -98,7 +98,7 @@ my-project/
|
|||||||
```
|
```
|
||||||
|
|
||||||
```go-html-template
|
```go-html-template
|
||||||
{{ $data := "" }}
|
{{ $data := dict }}
|
||||||
{{ $p := "data/books.json" }}
|
{{ $p := "data/books.json" }}
|
||||||
{{ with resources.Get $p }}
|
{{ with resources.Get $p }}
|
||||||
{{ $data = .Content | transform.Unmarshal }}
|
{{ $data = .Content | transform.Unmarshal }}
|
||||||
@ -121,7 +121,7 @@ my-project/
|
|||||||
```
|
```
|
||||||
|
|
||||||
```go-html-template
|
```go-html-template
|
||||||
{{ $data := "" }}
|
{{ $data := dict }}
|
||||||
{{ $p := "books.json" }}
|
{{ $p := "books.json" }}
|
||||||
{{ with .Resources.Get $p }}
|
{{ with .Resources.Get $p }}
|
||||||
{{ $data = .Content | transform.Unmarshal }}
|
{{ $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.
|
Consider using the [`resources.GetRemote`] function with [`transform.Unmarshal`] when accessing a remote resource to improve error handling and cache control.
|
||||||
|
|
||||||
```go-html-template
|
```go-html-template
|
||||||
{{ $data := "" }}
|
{{ $data := dict }}
|
||||||
{{ $u := "https://example.org/books.json" }}
|
{{ $u := "https://example.org/books.json" }}
|
||||||
{{ with resources.GetRemote $u }}
|
{{ with resources.GetRemote $u }}
|
||||||
{{ with .Err }}
|
{{ with .Err }}
|
||||||
|
@ -11,7 +11,7 @@ action:
|
|||||||
---
|
---
|
||||||
|
|
||||||
```go-html-template
|
```go-html-template
|
||||||
{{ $data := "" }}
|
{{ $data := dict }}
|
||||||
{{ $p := "data/books.json" }}
|
{{ $p := "data/books.json" }}
|
||||||
{{ with resources.Get $p }}
|
{{ with resources.Get $p }}
|
||||||
{{ $opts := dict "delimiter" "," }}
|
{{ $opts := dict "delimiter" "," }}
|
||||||
|
@ -73,7 +73,7 @@ When retrieving remote data, use the [`transform.Unmarshal`] function to [unmars
|
|||||||
[unmarshal]: /getting-started/glossary/#unmarshal
|
[unmarshal]: /getting-started/glossary/#unmarshal
|
||||||
|
|
||||||
```go-html-template
|
```go-html-template
|
||||||
{{ $data := "" }}
|
{{ $data := dict }}
|
||||||
{{ $url := "https://example.org/books.json" }}
|
{{ $url := "https://example.org/books.json" }}
|
||||||
{{ with resources.GetRemote $url }}
|
{{ with resources.GetRemote $url }}
|
||||||
{{ with .Err }}
|
{{ with .Err }}
|
||||||
|
@ -46,10 +46,10 @@ assets/
|
|||||||
```
|
```
|
||||||
|
|
||||||
```go-html-template
|
```go-html-template
|
||||||
{{ $data := "" }}
|
{{ $data := dict }}
|
||||||
{{ $path := "data/books.json" }}
|
{{ $path := "data/books.json" }}
|
||||||
{{ with resources.Get $path }}
|
{{ with resources.Get $path }}
|
||||||
{{ with unmarshal .Content }}
|
{{ with .Content | transform.Unmarshal }}
|
||||||
{{ $data = . }}
|
{{ $data = . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
@ -75,10 +75,10 @@ content/
|
|||||||
```
|
```
|
||||||
|
|
||||||
```go-html-template
|
```go-html-template
|
||||||
{{ $data := "" }}
|
{{ $data := dict }}
|
||||||
{{ $path := "books.json" }}
|
{{ $path := "books.json" }}
|
||||||
{{ with .Resources.Get $path }}
|
{{ with .Resources.Get $path }}
|
||||||
{{ with unmarshal .Content }}
|
{{ with .Content | transform.Unmarshal }}
|
||||||
{{ $data = . }}
|
{{ $data = . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
@ -95,7 +95,7 @@ content/
|
|||||||
A remote resource is a file on a remote server, accessible via HTTP or HTTPS.
|
A remote resource is a file on a remote server, accessible via HTTP or HTTPS.
|
||||||
|
|
||||||
```go-html-template
|
```go-html-template
|
||||||
{{ $data := "" }}
|
{{ $data := dict }}
|
||||||
{{ $url := "https://example.org/books.json" }}
|
{{ $url := "https://example.org/books.json" }}
|
||||||
{{ with resources.GetRemote $url }}
|
{{ with resources.GetRemote $url }}
|
||||||
{{ with .Err }}
|
{{ with .Err }}
|
||||||
@ -166,7 +166,7 @@ When unmarshaling an XML file, do not include the root node when accessing data.
|
|||||||
Get the remote data:
|
Get the remote data:
|
||||||
|
|
||||||
```go-html-template
|
```go-html-template
|
||||||
{{ $data := "" }}
|
{{ $data := dict }}
|
||||||
{{ $url := "https://example.org/books/index.xml" }}
|
{{ $url := "https://example.org/books/index.xml" }}
|
||||||
{{ with resources.GetRemote $url }}
|
{{ with resources.GetRemote $url }}
|
||||||
{{ with .Err }}
|
{{ with .Err }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user