mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-13 16:14:59 +00:00
Fix broken link in site variables
This commit is contained in:
1 parent
bfd6a131f6
commit
aeaaa42ce5
2 files changed
+10
-8
No files matched your search
@@ -20,6 +20,12 @@ draft: false
|
|||||||
aliases: []
|
aliases: []
|
||||||
---
|
---
|
||||||
|
|
||||||
|
`delimit` called in your template takes the form of
|
||||||
|
|
||||||
|
```
|
||||||
|
{{ delimit array/slice/map delimiter optionallastdelimiter}}
|
||||||
|
```
|
||||||
|
|
||||||
`delimit` loops through any array, slice, or map and returns a string of all the values separated by a delimiter, the second argument in the function call. There is an optional third parameter that lets you choose a different delimiter to go between the last two values in the loop.
|
`delimit` loops through any array, slice, or map and returns a string of all the values separated by a delimiter, the second argument in the function call. There is an optional third parameter that lets you choose a different delimiter to go between the last two values in the loop.
|
||||||
|
|
||||||
To maintain a consistent output order, maps will be sorted by keys and only a slice of the values will be returned.
|
To maintain a consistent output order, maps will be sorted by keys and only a slice of the values will be returned.
|
||||||
@@ -35,19 +41,15 @@ tags: [ "tag1", "tag2", "tag3" ]
|
|||||||
```
|
```
|
||||||
{{% /code %}}
|
{{% /code %}}
|
||||||
|
|
||||||
`delimit` called in your template takes the form of
|
|
||||||
|
|
||||||
```
|
|
||||||
{{ delimit array/slice/map delimiter optionallastdelimiter}}
|
|
||||||
```
|
|
||||||
|
|
||||||
{{% code file="delimit-pages-tags.html" %}}
|
{{% code file="delimit-page-tags-input.html" %}}
|
||||||
```html
|
```html
|
||||||
<p>Tags: {{ delimit .Params.tags ", " }}</p>
|
<p>Tags: {{ delimit .Params.tags ", " }}</p>
|
||||||
```
|
```
|
||||||
{{% /code %}}
|
{{% /code %}}
|
||||||
|
|
||||||
{{% output "delimit-pages-tags-output.html" %}}
|
{{% output "delimit-page-tags-output.html" %}}
|
||||||
```html
|
```html
|
||||||
<p>Tags: tag1, tag2, tag3</p>
|
<p>Tags: tag1, tag2, tag3</p>
|
||||||
```
|
```
|
||||||
@@ -55,7 +57,7 @@ tags: [ "tag1", "tag2", "tag3" ]
|
|||||||
|
|
||||||
Here is the same example but with the optional "last" delimiter:
|
Here is the same example but with the optional "last" delimiter:
|
||||||
|
|
||||||
{{% code file="delimit-page-tags-final-and.html" %}}
|
{{% code file="delimit-page-tags-final-and-input.html" %}}
|
||||||
```golang
|
```golang
|
||||||
Tags: {{ delimit .Params.tags ", " ", and " }}
|
Tags: {{ delimit .Params.tags ", " ", and " }}
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ The following is a list of site-level variables (aka "global"). Many of these va
|
|||||||
: a string representing the copyright of your website as defined in the site configuration.
|
: a string representing the copyright of your website as defined in the site configuration.
|
||||||
|
|
||||||
`.Site.Data`
|
`.Site.Data`
|
||||||
: custom data, see [Data Templates](/templates/date-templates/).
|
: custom data, see [Data Templates](/templates/data-templates/).
|
||||||
|
|
||||||
`.Site.DisqusShortname`
|
`.Site.DisqusShortname`
|
||||||
: a string representing the shortname of the Disqus shortcode as defined in the site configuration.
|
: a string representing the shortname of the Disqus shortcode as defined in the site configuration.
|
||||||
|
|||||||
Reference in new issue
Block a user