Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul van Brouwershaven <vanbroup@users.noreply.github.com>2021-12-02 19:30:36 +0300
committerGitHub <noreply@github.com>2021-12-02 19:30:36 +0300
commit0eaaa8fee37068bfc8ecfb760f770ecc9a7af22a (patch)
tree95cf7c5ac3a7e56c0eb411a28cae5c0412a510bd /docs/content/en/templates
parent58adbeef88ea5c8769d12ba27eef2d89bdf575eb (diff)
Implement XML data support
Example: ``` {{ with resources.Get "https://example.com/rss.xml" | transform.Unmarshal }} {{ range .channel.item }} <strong>{{ .title | plainify | htmlUnescape }}</strong><br /> <p>{{ .description | plainify | htmlUnescape }}</p> {{ $link := .link | plainify | htmlUnescape }} <a href="{{ $link }}">{{ $link }}</a><br /> <hr> {{ end }} {{ end }} ``` Closes #4470
Diffstat (limited to 'docs/content/en/templates')
-rw-r--r--docs/content/en/templates/data-templates.md10
1 files changed, 6 insertions, 4 deletions
diff --git a/docs/content/en/templates/data-templates.md b/docs/content/en/templates/data-templates.md
index c36344776..441cc2f10 100644
--- a/docs/content/en/templates/data-templates.md
+++ b/docs/content/en/templates/data-templates.md
@@ -6,7 +6,7 @@ date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-03-12
categories: [templates]
-keywords: [data,dynamic,csv,json,toml,yaml]
+keywords: [data,dynamic,csv,json,toml,yaml,xml]
menu:
docs:
parent: "templates"
@@ -20,7 +20,7 @@ toc: true
<!-- begin data files -->
-Hugo supports loading data from YAML, JSON, and TOML files located in the `data` directory in the root of your Hugo project.
+Hugo supports loading data from YAML, JSON, XML, and TOML files located in the `data` directory in the root of your Hugo project.
{{< youtube FyPgSuwIMWQ >}}
@@ -28,7 +28,7 @@ Hugo supports loading data from YAML, JSON, and TOML files located in the `data`
The `data` folder is where you can store additional data for Hugo to use when generating your site. Data files aren't used to generate standalone pages; rather, they're meant to be supplemental to content files. This feature can extend the content in case your front matter fields grow out of control. Or perhaps you want to show a larger dataset in a template (see example below). In both cases, it's a good idea to outsource the data in their own files.
-These files must be YAML, JSON, or TOML files (using the `.yml`, `.yaml`, `.json`, or `.toml` extension). The data will be accessible as a `map` in the `.Site.Data` variable.
+These files must be YAML, JSON, XML, or TOML files (using the `.yml`, `.yaml`, `.json`, `.xml`, or `.toml` extension). The data will be accessible as a `map` in the `.Site.Data` variable.
## Data Files in Themes
@@ -95,7 +95,7 @@ Discover a new favorite bass player? Just add another `.toml` file in the same d
## Example: Accessing Named Values in a Data File
-Assume you have the following data structure in your `User0123.[yml|toml|json]` data file located directly in `data/`:
+Assume you have the following data structure in your `User0123.[yml|toml|xml|json]` data file located directly in `data/`:
{{< code-toggle file="User0123" >}}
Name: User0123
@@ -232,6 +232,7 @@ If you change any local file and the LiveReload is triggered, Hugo will read the
* [YAML Spec][yaml]
* [JSON Spec][json]
* [CSV Spec][csv]
+* [XML Spec][xml]
[config]: /getting-started/configuration/
[csv]: https://tools.ietf.org/html/rfc4180
@@ -247,3 +248,4 @@ If you change any local file and the LiveReload is triggered, Hugo will read the
[variadic]: https://en.wikipedia.org/wiki/Variadic_function
[vars]: /variables/
[yaml]: https://yaml.org/spec/
+[xml]: https://www.w3.org/XML/