summaryrefslogtreecommitdiffstats
path: root/docs/content/en/methods/site/Data.md
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2024-06-21 09:41:24 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2024-06-21 09:41:24 +0200
commitaf0cb57aaf668278551454678eac60b17348b13c (patch)
treeb0fbd866cfc5e605ff789de9d6d9b162094a217b /docs/content/en/methods/site/Data.md
parentd5542ed286746e89fb13a1f821d4955ace371773 (diff)
parent8b9803425e63e1b1801f8d5d676e96368d706722 (diff)
downloadhugo-af0cb57aaf668278551454678eac60b17348b13c.tar.gz
hugo-af0cb57aaf668278551454678eac60b17348b13c.zip
Merge commit '8b9803425e63e1b1801f8d5d676e96368d706722'
Diffstat (limited to 'docs/content/en/methods/site/Data.md')
-rw-r--r--docs/content/en/methods/site/Data.md12
1 files changed, 9 insertions, 3 deletions
diff --git a/docs/content/en/methods/site/Data.md b/docs/content/en/methods/site/Data.md
index b78caddec..65cdadd01 100644
--- a/docs/content/en/methods/site/Data.md
+++ b/docs/content/en/methods/site/Data.md
@@ -20,7 +20,7 @@ Use the `Data` method on a `Site` object to access data within the data director
{{% note %}}
Although Hugo can unmarshal CSV files with the [`transform.Unmarshal`] function, do not place CSV files in the data directory. You cannot access data within CSV files using this method.
-[`transform.Unmarshal`]: /functions/transform/unmarshal
+[`transform.Unmarshal`]: /functions/transform/unmarshal/
{{% /note %}}
Consider this data directory:
@@ -101,8 +101,14 @@ To find a fiction book by ISBN:
{{ end }}
```
-In the template examples above, each of the keys is a valid identifier. For example, none of the keys contains a hyphen. To access a key that is not a valid identifier, use the [`index`] function:
+In the template examples above, each of the keys is a valid [identifier]. For example, none of the keys contains a hyphen. To access a key that is not a valid identifier, use the [`index`] function. For example:
-[`index`]: /functions/collections/indexfunction
+[identifier]: /getting-started/glossary/#identifier
+
+```go-html-template
+{{ index .Site.Data.books "historical-fiction" }}
+```
+
+[`index`]: /functions/collections/indexfunction/
[chaining]: /getting-started/glossary/#chain
[identifiers]: /getting-started/glossary/#identifier