mirror of
https://github.com/gohugoio/hugo.git
synced 2025-02-18 16:53:53 +00:00
docs: make the named value Data File example simpler
This commit is contained in:
parent
e96624cce8
commit
67209dbfb3
1 changed files with 4 additions and 4 deletions
|
@ -88,7 +88,7 @@ Assuming you have the following YAML structure to your `User0123.yml` Data File
|
||||||
|
|
||||||
```
|
```
|
||||||
Name: User0123
|
Name: User0123
|
||||||
"Short Description": "He is a jolly good fellow."
|
"Short Description": "He is a **jolly good** fellow."
|
||||||
Achievements:
|
Achievements:
|
||||||
- "Can create a Key, Value list from Data File"
|
- "Can create a Key, Value list from Data File"
|
||||||
- "Learns Hugo"
|
- "Learns Hugo"
|
||||||
|
@ -98,7 +98,7 @@ Achievements:
|
||||||
To render the `Short Description` in your `layout` File following code is required.
|
To render the `Short Description` in your `layout` File following code is required.
|
||||||
|
|
||||||
```
|
```
|
||||||
{{ $.Scratch.Set "ShortDesc" ( index $.Site.Data.User0123 "Short Description" ) }}
|
<div>Short Description of {{.Site.Data.User0123.Name}}: <p>{{ index .Site.Data.User0123 "Short Description" | markdownify }}</p></div>
|
||||||
<div>Short Description of {{.Site.Data.User0123.Name}}: <p>{{ $.Scratch.Get "ShortDesc" }}</p></div>
|
|
||||||
{{ end }}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note the use of the `markdownify` template function. This will send the description through the Blackfriday Markdown rendering engine.
|
Loading…
Reference in a new issue