Add function signatures

Fixes rdwatters/hugo-docs-concept#31
This commit is contained in:
Cameron Moore
2017-03-27 15:25:53 -05:00
parent c698a77dff
commit da71775958
89 changed files with 159 additions and 147 deletions
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [sections,lists,indexes]
ns:
signature: []
signature: ["GetPage TYPE PATH"]
workson: []
hugoversion:
relatedfuncs: []
@@ -51,4 +51,4 @@ This code snippet---in the form of a [partial template][partials]---allows you t
[partials]: /templates/partials/
[taxonomy]: /content-management/taxonomies/
[taxonomy]: /content-management/taxonomies/
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [multilingual,i18n,urls]
ns:
signature: []
signature: ["absLangURL INPUT"]
workson: []
hugoversion:
relatedfuncs: [relLangURL]
@@ -25,4 +25,4 @@ So for a site `baseURL` set to `http://yoursite.com/hugo/` and the current lang
```golang
{{ "blog/" | absLangURL }} "http://yoursite.com/hugo/en/blog/"
{{ "blog/" | relLangURL }} "/hugo/en/blog/"
```
```
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [urls]
ns:
signature: []
signature: ["absURL INPUT"]
workson: []
hugoversion:
relatedfuncs: [relURL]
@@ -49,4 +49,4 @@ The above uses the [apply function][] and also exposes how the Go template parse
[apply function]: /functions/apply/
[configuration]: /getting-started/configuration/
[jsonld]: https://developers.google.com/search/docs/guides/intro-structured-data
[safejs]: /functions/safejs
[safejs]: /functions/safejs
+2 -2
View File
@@ -9,8 +9,8 @@ lastmod: 2017-02-01
categories: [functions]
tags: [dates,time]
ns:
signature: []
workson: []
signature: ["AddDate YEARS MONTHS DAYS"]
workson: [times]
hugoversion:
relatedfuncs: [now]
deprecated: false
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [iteration]
ns:
signature: []
signature: ["after INDEX COLLECTION"]
workson: []
hugoversion:
relatedfuncs: [last,first,seq]
@@ -64,4 +64,4 @@ You can use `after` in combination with the [`first` function][] and Hugo's [pow
[`first` function]: /functions/first/
[list/section page]: /templates/section-templates/
[lists]: /lists/
[slice]: /functions/slice/
[slice]: /functions/slice/
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [advanced]
ns:
signature: []
signature: ["apply COLLETION FUNCTION [PARAM...]"]
workson: []
hugoversion:
relatedfuncs: []
@@ -119,4 +119,4 @@ Now in the completed version, you can sort the tags, convert the tags to links w
[delimit]: /functions/delimit/ "See documentation for the delimit function"
[functions]: /functions/ "See the full list of Hugo functions to see what can be passed as an argument to the apply function."
[partials]: /templates/partials/
[range]: /functions/range/ "Learn the importance of the range function, a fundamental keyword in both Hugo templates and the Go programming language."
[range]: /functions/range/ "Learn the importance of the range function, a fundamental keyword in both Hugo templates and the Go programming language."
+3 -3
View File
@@ -1,6 +1,6 @@
---
title: base64
linktitle: base64
linktitle: base64Encode and base64Decode
description: base64Encode and base64Decode let you easily decode content with a base64 encoding and vice versa through pipes.
godocref:
date: 2017-02-01
@@ -10,7 +10,7 @@ categories: [functions]
tags: []
relatedfuncs: []
ns:
signature: []
signature: ["base64Decode INPUT", "base64Encode INPUT"]
workson: []
hugoversion:
deprecated: false
@@ -51,4 +51,4 @@ responses from APIs.
{{ $resp.content | base64Decode | markdownify }}
```
The response of the GitHub API contains the base64-encoded version of the [README.md](https://github.com/spf13/hugo/blob/master/README.md) in the Hugo repository. Now we can decode it and parse the Markdown. The final output will look similar to the rendered version on GitHub.
The response of the GitHub API contains the base64-encoded version of the [README.md](https://github.com/spf13/hugo/blob/master/README.md) in the Hugo repository. Now we can decode it and parse the Markdown. The final output will look similar to the rendered version on GitHub.
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [trim]
ns:
signature: []
signature: ["chomp INPUT"]
workson: []
hugoversion:
relatedfuncs: [truncate]
@@ -20,4 +20,4 @@ Removes any trailing newline characters. Useful in a pipeline to remove newlines
```golang
{{chomp "<p>Blockhead</p>\n"}} "<p>Blockhead</p>"
```
```
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [counting, word count]
ns:
signature: []
signature: ["countrunes INPUT"]
workson: []
hugoversion:
relatedfuncs: []
@@ -24,4 +24,4 @@ In contrast with `countwords` function, which counts every word in a string, the
<!-- outputs a content length of 8 runes. -->
```
[pagevars]: /variables/page/
[pagevars]: /variables/page/
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [counting, word count]
ns:
signature: []
signature: ["countwords INPUT"]
workson: []
hugoversion:
relatedfuncs: [countrunes]
@@ -25,4 +25,4 @@ aliases: [/functions/countrunes/,/functions/countwords/]
```
[pagevars]: /variables/page/
[pagevars]: /variables/page/
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [dates,time,strings]
ns:
signature: []
signature: ["dateFormat LAYOUT INPUT"]
workson: []
hugoversion:
relatedfuncs: [Format,now,Unix,time]
+1 -1
View File
@@ -11,7 +11,7 @@ tags: [defaults]
categories: [functions]
toc:
ns:
signature: []
signature: ["default DEFAULT INPUT"]
workson: []
hugoversion:
relatedfuncs: []
+2 -2
View File
@@ -12,7 +12,7 @@ categories: [functions]
tags: [iteration]
toc: false
ns:
signature: []
signature: ["delimit COLLECTION DELIMIT LAST"]
workson: [lists,taxonomies,terms]
hugoversion:
relatedfuncs: []
@@ -71,4 +71,4 @@ Tags: {{ delimit .Params.tags ", " ", and " }}
[lists]: /templates/lists/
[taxonomies]: /templates/taxonomy-templates/#taxonomy-list-templates
[terms]: /templates/taxonomy-templates/#terms-list-templates
[terms]: /templates/taxonomy-templates/#terms-list-templates
+2 -2
View File
@@ -10,7 +10,7 @@ lastmod: 2017-02-26
categories: [functions]
tags: [dictionary]
ns:
signature: []
signature: ["dict KEY VALUE [KEY VALUE]..."]
workson: []
hugoversion:
relatedfuncs: []
@@ -49,4 +49,4 @@ Important {{.important}}
```
{{% /code %}}
[partials]: /templates/partials/
[partials]: /templates/partials/
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: []
ns:
signature: []
signature: ["echoParam DICTIONARY KEY"]
workson: []
hugoversion:
relatedfuncs: []
@@ -22,4 +22,4 @@ aliases: []
```
{{ echoParam .Params "project_url" }}
```
```
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [strings,emojis]
ns:
signature: []
signature: ["emojify INPUT"]
workson: []
hugoversion:
relatedfuncs: []
@@ -32,4 +32,4 @@ I :heart: Hugo!
[config]: /getting-started/configuration/
[emojis]: http://www.emoji-cheat-sheet.com/
[sc]: /templates/shortcode-templates/
[scsource]: https://github.com/spf13/hugo/tree/master/docs/layouts/shortcodes
[scsource]: https://github.com/spf13/hugo/tree/master/docs/layouts/shortcodes
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [operators,logic]
ns:
signature: []
signature: ["eq ARG1 ARG2"]
workson: []
hugoversion:
relatedfuncs: []
@@ -21,4 +21,4 @@ aliases: []
```
{{ if eq .Section "blog" }}current{{ end }}
```
```
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [regex]
ns:
signature: []
signature: ["findRE PATTERN INPUT [LIMIT]"]
workson: []
hugoversion:
relatedfuncs: []
@@ -60,4 +60,4 @@ The preceding snippet tries to find all second-level headers and generate a list
[partials]: /templates/partials/
[`plainify`]: /functions/plainify/
[toc]: /content-management/toc/
[`urlize`]: /functions/urlize
[`urlize`]: /functions/urlize
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [iteration]
ns:
signature: []
signature: ["first LIMIT COLLECTION"]
workson: [lists,taxonomies,terms,groups]
hugoversion:
relatedfuncs: [after,last]
+2 -2
View File
@@ -9,8 +9,8 @@ lastmod: 2017-02-01
categories: [functions]
tags: [dates,time]
ns:
signature: []
workson: []
signature: ["Format FORMAT"]
workson: [times]
hugoversion:
relatedfuncs: [dateFormat,now,Unix,time]
deprecated: false
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [shortcodes]
ns:
signature: []
signature: ["Get INDEX", "Get KEY"]
workson: []
hugoversion:
relatedfuncs: []
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: []
ns:
signature: []
signature: ["getenv VARIABLE"]
workson: []
hugoversion:
relatedfuncs: []
@@ -26,4 +26,4 @@ variable must also be exported in order to be seen by `hugo`.
```
{{ getenv "HOME" }}
```
```
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: []
ns:
signature: []
signature: ["hasPrefix STRING PREFIX"]
workson: []
hugoversion:
relatedfuncs: []
@@ -19,4 +19,4 @@ aliases: []
`hasPrefix` tests whether a string begins with prefix.
* `{{ hasPrefix "Hugo" "Hu" }}` → true
* `{{ hasPrefix "Hugo" "Hu" }}` → true
+3 -3
View File
@@ -10,8 +10,8 @@ categories: [functions]
tags: [menus]
toc:
ns:
signature: []
workson: []
signature: ["HasChildren"]
workson: [menus]
hugoversion:
relatedfuncs: []
deprecated: false
@@ -20,4 +20,4 @@ aliases: []
needsexamples: true
---
Used in [menu templates](/templates/menu-templates/).
Used in [menu templates](/templates/menu-templates/).
+2 -2
View File
@@ -9,8 +9,8 @@ lastmod: 2017-02-01
categories: [functions]
tags: [menus]
ns:
signature: []
workson: []
signature: ["HasMenuCurrent"]
workson: [menus]
hugoversion:
relatedfuncs: []
deprecated: false
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [highlighting,pygments,code blocks,syntax]
ns:
signature: []
signature: ["highlight INPUT"]
workson: []
hugoversion:
relatedfuncs: []
@@ -25,4 +25,4 @@ See [Installing Hugo][installpygments] for more information on Pygments or [Synt
[highlight]: /content-management/shortcodes/#highlight
[installpygments]: /getting-started/installing/#installing-pygments-optional
[syntax]: /tools/syntax-highlighting/
[syntax]: /tools/syntax-highlighting/
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [strings, html]
ns:
signature: []
signature: ["htmlEscape INPUT"]
workson: []
hugoversion:
relatedfuncs: [htmlUnescape]
@@ -23,4 +23,4 @@ Bear in mind that, unless content is passed to `safeHTML`, output strings are es
```
{{ htmlEscape "Hugo & Caddy > Wordpress & Apache" }} → "Hugo &amp; Caddy &gt; Wordpress &amp; Apache"
```
```
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: []
ns:
signature: []
signature: ["htmlUnescape INPUT"]
workson: []
hugoversion:
relatedfuncs: [htmlEscape]
@@ -23,4 +23,4 @@ Remember to pass the output of this to `safeHTML` if fully un-escaped characters
```
{{ htmlUnescape "Hugo &amp; Caddy &gt; Wordpress &amp; Apache" }} → "Hugo & Caddy > Wordpress & Apache"
```
```
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [strings,casing]
ns:
signature: []
signature: ["humanize INPUT"]
workson: []
hugoversion:
relatedfuncs: []
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [internationalization,i18n,multilingual]
ns:
signature: []
signature: ["i18n KEY", "T KEY"]
workson: []
hugoversion:
relatedfuncs: []
@@ -29,4 +29,4 @@ This translates a piece of content based on your `i18n/en-US.yaml` (and friends)
For more information about string translations, see [Translation of Strings in Multilingual Mode][multistrings].
[multistrings]: /content-management/multilingual/#translation-of-strings
[multistrings]: /content-management/multilingual/#translation-of-strings
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [images]
ns:
signature: []
signature: ["imageConfig PATH"]
workson: []
hugoversion:
relatedfuncs: []
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [strings]
ns:
signature: []
signature: ["in SET ITEM"]
workson: []
hugoversion:
relatedfuncs: []
@@ -28,4 +28,4 @@ In addition, `in` can also check if a substring exists in a string.
```
{{ if in "this string contains a substring" "substring" }}Substring found!{{ end }}
```
```
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: []
ns:
signature: []
signature: ["index COLLECTION INDEX", "index COLLECTION KEY"]
workson: []
hugoversion:
relatedfuncs: []
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [strings,integers]
ns:
signature: []
signature: ["int INPUT"]
workson: []
hugoversion:
relatedfuncs: []
@@ -21,4 +21,4 @@ Creates an integer (`int`) from the argument passed into the function. Useful fo
```
{{ int "123" }} → 123
```
```
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: []
ns:
signature: []
signature: ["intersect SET1 SET2"]
workson: []
hugoversion:
relatedfuncs: []
@@ -40,4 +40,4 @@ The following is an example of a "related posts" [partial template][partials] th
{{% /code %}}
[partials]: /templates/partials/
[single]: /templates/single-page-templates/
[single]: /templates/single-page-templates/
+3 -3
View File
@@ -9,8 +9,8 @@ lastmod: 2017-02-01
categories: [functions]
tags: [menus]
ns:
signature: []
workson: []
signature: ["IsMenuCurrent"]
workson: [menus]
hugoversion:
relatedfuncs: []
deprecated: false
@@ -18,4 +18,4 @@ draft: false
aliases: []
---
Used in [menu templates](/templates/menu-templates/).
Used in [menu templates](/templates/menu-templates/).
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: []
ns:
signature: []
signature: ["isset COLLECTION INDEX", "isset COLLECTION KEY"]
workson: []
hugoversion:
relatedfuncs: []
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [strings,json]
ns:
signature: []
signature: ["jsonify INPUT"]
workson: []
hugoversion:
relatedfuncs: [plainify]
@@ -25,4 +25,4 @@ aliases: []
See also the `.PlainWords`, `.Plain`, and `.RawContent` [page variables][pagevars].
[pagevars]: /variables/page/
[pagevars]: /variables/page/
+1 -1
View File
@@ -10,7 +10,7 @@ tags: []
categories: [functions]
toc:
ns:
signature: []
signature: ["last INDEX COLLECTION"]
workson: [lists, taxonomies, terms, groups]
hugoversion:
relatedfuncs: []
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [strings,casing]
ns:
signature: []
signature: ["lower INPUT"]
workson: []
hugoversion:
relatedfuncs: []
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
tags: [markdown,content]
categories: [functions]
ns:
signature: []
signature: ["markdownify INPUT"]
workson: []
hugoversion:
relatedfuncs: []
@@ -21,4 +21,4 @@ aliases: []
```
{{ .Title | markdownify }}
```
```
+1 -1
View File
@@ -28,4 +28,4 @@ There are 6 basic mathematical operators that can be used in Hugo templates:
| `mod` | Modulus of two integers. | `{{mod 15 3}}` &rarr; 0 |
| `modBool`| Boolean of modulus of two integers. Evaluates to `true` if = 0. | `{{modBool 15 3}}` &rarr; true |
| `mul` | Multiplies two integers. | `{{mul 2 3}}` &rarr; 6 |
| `sub` | Subtracts two integers. | `{{sub 3 2}}` &rarr; 1 |
| `sub` | Subtracts two integers. | `{{sub 3 2}}` &rarr; 1 |
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: []
ns:
signature: []
signature: ["md5 INPUT"]
workson: []
hugoversion:
relatedfuncs: []
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [dates,time]
ns:
signature: []
signature: ["now"]
workson: []
hugoversion:
relatedfuncs: [Unix,dateFormat]
+2 -2
View File
@@ -10,7 +10,7 @@ tags: []
categories: [functions]
toc:
ns:
signature: []
signature: ["Param KEY"]
workson: []
hugoversion:
relatedfuncs: []
@@ -32,4 +32,4 @@ $.Param "image"
[configuration]: /getting-started/configuration/
[pagevars]: /variables/page/
[sitevars]: /variables/site/
[sitevars]: /variables/site/
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: []
ns:
signature: []
signature: ["partialCached LAYOUT INPUT [VARIANT...]"]
workson: []
hugoversion:
relatedfuncs: []
@@ -37,4 +37,4 @@ If you need to pass additional parameters to create unique variants, you can pas
{{ partialCached "footer.html" . .Params.country .Params.province }}
```
Note that the variant parameters are not made available to the underlying partial template. They are only use to create a unique cache key.
Note that the variant parameters are not made available to the underlying partial template. They are only use to create a unique cache key.
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [strings]
ns:
signature: []
signature: ["plainify INPUT"]
workson: []
hugoversion:
relatedfuncs: [jsonify]
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [strings]
ns:
signature: []
signature: ["pluralize INPUT"]
workson: []
hugoversion:
relatedfuncs: []
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [strings]
ns:
signature: []
signature: ["printf FORMAT INPUT"]
workson: []
hugoversion:
relatedfuncs: []
@@ -25,4 +25,4 @@ needsexamples: true
```
{{ printf "formatted %.2f" 3.1416 }}
```
```
+2 -2
View File
@@ -9,7 +9,7 @@ categories: [functions]
tags: [urls]
godocref:
ns:
signature: []
signature: ["querify KEY VALUE [KEY VALUE]..."]
hugoversion:
deprecated: false
workson: []
@@ -29,4 +29,4 @@ This example renders the following HTML:
```html
<a href="https://www.google.com?page=3&q=test">Search</a>
```
```
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [iteration,fundamentals]
ns:
signature: []
signature: ["range COLLECTION"]
workson: []
hugoversion:
relatedfuncs: []
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [files]
ns:
signature: []
signature: ["readDir PATH"]
workson: []
hugoversion:
relatedfuncs: [readFile]
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [files]
ns:
signature: []
signature: ["readFile PATH"]
workson: []
hugoversion:
relatedfuncs: [readDir]
@@ -27,4 +27,4 @@ So, if you have a file with the name `README.txt` in the root of your project wi
For more information on using `readDir` and `readFile` in your templates, see [Local File Templates][local].
[local]: /templates/files/
[local]: /templates/files/
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [cross references, anchors]
ns:
signature: []
signature: ["ref PAGE CONTENT"]
workson: []
hugoversion:
relatedfuncs: [relref]
@@ -25,4 +25,4 @@ aliases: []
These functions are used in two of Hugo's built-in shortcodes. You can see basic usage examples of both `ref` and `relref` in the [shortcode documentation](/content-management/shortcodes/#ref-and-relref).
For an extensive explanation of how to leverage `ref` and `relref` for content management, see [Cross References](/content-management/cross-references/).
For an extensive explanation of how to leverage `ref` and `relref` for content management, see [Cross References](/content-management/cross-references/).
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
tags: [multilingual,i18n,urls]
categories: [functions]
ns:
signature: []
signature: ["relLangURL INPUT"]
workson: []
hugoversion:
relatedfuncs: []
@@ -27,4 +27,4 @@ So for a site `baseURL` set to `http://yoursite.com/hugo/` and the current lang
{{ "blog/" | relLangURL }} "/hugo/en/blog/"
```
[multiliconfig]: /content-management/multilingual/#configuring-multilingual-mode
[multiliconfig]: /content-management/multilingual/#configuring-multilingual-mode
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [cross references, anchors]
ns:
signature: []
signature: ["relref PAGE CONTENT"]
workson: []
hugoversion:
relatedfuncs: [relref]
@@ -25,4 +25,4 @@ aliases: []
These functions are used in two of Hugo's built-in shortcodes. You can see basic usage examples of both `ref` and `relref` in the [shortcode documentation](/content-management/shortcodes/#ref-and-relref).
For an extensive explanation of how to leverage `ref` and `relref` for content management, see [Cross References](/content-management/cross-references/).
For an extensive explanation of how to leverage `ref` and `relref` for content management, see [Cross References](/content-management/cross-references/).
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [urls]
ns:
signature: []
signature: ["relURL INPUT"]
workson: []
hugoversion:
relatedfuncs: [absURL]
@@ -49,4 +49,4 @@ The above uses the [apply function][] and also exposes how the Go template parse
[apply function]: /functions/apply/
[configuration]: /getting-started/configuration/
[jsonld]: https://developers.google.com/search/docs/guides/intro-structured-data
[safejs]: /functions/safejs
[safejs]: /functions/safejs
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [views]
ns:
signature: []
signature: ["render LAYOUT"]
workson: []
hugoversion:
relatedfuncs: []
@@ -29,4 +29,4 @@ This example could render a piece of content using the content view located at `
{{ end }}
```
[list context]: /templates/lists/
[list context]: /templates/lists/
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: []
ns:
signature: []
signature: ["replace INPUT OLD NEW"]
workson: []
hugoversion:
relatedfuncs: []
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [regex]
ns:
signature: []
signature: ["replaceRE PATTERN REPLACEMENT INPUT"]
workson: []
hugoversion:
relatedfuncs: []
@@ -22,4 +22,4 @@ Replaces all occurrences of a regular expression with the replacement pattern.
```golang
{{ replaceRE "^https?://([^/]+).*" "$1" "http://gohugo.io/docs" }}` → "gohugo.io"
{{ "http://gohugo.io/docs" | replaceRE "^https?://([^/]+).*" "$1" }}` "gohugo.io"
```
```
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-26
categories: [functions]
tags: [style,css,strings]
ns:
signature: []
signature: ["safeCSS INPUT"]
workson: []
hugoversion:
relatedfuncs: [safeHTML,safeHTMLAttr,]
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [strings]
ns:
signature: []
signature: ["safeHTML INPUT"]
workson: []
hugoversion:
relatedfuncs: []
@@ -38,4 +38,4 @@ However, without the `safeHTML` function, html/template assumes `.Site.Copyright
<p>© 2015 Jane Doe. &lt;a href=&#34;http://creativecommons.org/licenses by/4.0/&#34;&gt;Some rights reserved&lt;/a&gt;.</p>
```
[config]: /getting-started/configuration/
[config]: /getting-started/configuration/
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [strings]
ns:
signature: []
signature: ["safeHTMLAttr INPUT"]
workson: []
hugoversion:
relatedfuncs: []
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [strings]
ns:
signature: []
signature: ["safeJS INPUT"]
workson: []
hugoversion:
relatedfuncs: []
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
tags: [strings,urls]
categories: [functions]
ns:
signature: []
signature: ["safeURL INPUT"]
workson: []
hugoversion:
relatedfuncs: []
+1 -1
View File
@@ -69,4 +69,4 @@ The usage is best illustrated with some samples:
**Note:** The examples above uses the special `$` variable, which refers to the top-level node. This is the behavior you most likely want, and will help remove some confusion when using `Scratch` inside page range loops -- and you start inadvertently calling the wrong `Scratch`. But there may be use cases for `{{ .Scratch.Add "key" "some value" }}`.
[pagevars]: /variables/page/
[pagevars]: /variables/page/
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: []
ns:
signature: []
signature: ["seq LAST", "seq FIRST LAST", "seq FIRST INCREMENT LAST"]
workson: []
hugoversion:
relatedfuncs: []
@@ -46,4 +46,4 @@ $indexStartingAt1 := (add $index 1)
```
[GNU's seq]: http://www.gnu.org/software/coreutils/manual/html_node/seq-invocation.html#seq-invocation
[GNU's seq]: http://www.gnu.org/software/coreutils/manual/html_node/seq-invocation.html#seq-invocation
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [sha,checksum]
ns:
signature: []
signature: ["sha1 INPUT", "sha256 INPUT"]
workson: []
hugoversion:
relatedfuncs: []
@@ -29,4 +29,4 @@ aliases: []
```html
{{ sha256 "Hello world, gophers!" }}
<!-- returns the string "6ec43b78da9669f50e4e422575c54bf87536954ccd58280219c393f2ce352b46" -->
```
```
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
tags: [ordering]
categories: [functions]
ns:
signature: []
signature: ["shuffle COLLECTION"]
workson: []
hugoversion:
relatedfuncs: []
@@ -37,4 +37,4 @@ This example would return the following:
```
{{% /output %}}
This example also makes use of the [slice](/functions/slice/) and [seq](/functions/seq/) functions.
This example also makes use of the [slice](/functions/slice/) and [seq](/functions/seq/) functions.
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [strings,singular]
ns:
signature: []
signature: ["singularize INPUT"]
workson: []
hugoversion:
relatedfuncs: []
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [slice, array, interface]
ns:
signature: []
signature: ["slice ITEM..."]
workson: []
hugoversion:
relatedfuncs: []
@@ -32,4 +32,4 @@ One use case is the concatenation of elements in combination with the [`delimit`
{{% /code %}}
[`delimit` function]: /functions/delimit/
[`delimit` function]: /functions/delimit/
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [strings]
ns:
signature: []
signature: ["slicestr STRING START [END]"]
workson: []
hugoversion:
relatedfuncs: []
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [strings]
ns:
signature: []
signature: ["split STRING DELIM"]
workson: []
hugoversion:
relatedfuncs: []
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [strings]
ns:
signature: []
signature: ["string INPUT"]
workson: []
hugoversion:
relatedfuncs: []
+2 -2
View File
@@ -10,7 +10,7 @@ categories: [functions]
tags: [strings]
aliases: []
ns:
signature: []
signature: ["substr STRING START [LENGTH]"]
workson: []
hugoversion:
relatedfuncs: []
@@ -28,4 +28,4 @@ In addition, borrowing from the extended behavior described at http://php.net su
```
{{substr "BatMan" 0 -3}} → "Bat"
{{substr "BatMan" 3 3}} → "Man"
```
```
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [dates,time]
ns:
signature: []
signature: ["time INPUT"]
workson: []
hugoversion:
relatedfuncs: []
@@ -23,4 +23,4 @@ aliases: []
{{ time "2016-05-28" }} → "2016-05-28T00:00:00Z"
{{ (time "2016-05-28").YearDay }} → 149
{{ mul 1000 (time "2016-05-28T10:30:00.00+10:00").Unix }} → 1464395400000, or Unix time in milliseconds
```
```
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [fundamentals,strings]
ns:
signature: []
signature: ["title INPUT"]
workson: []
hugoversion:
relatedfuncs: []
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [strings]
ns:
signature: []
signature: ["trim INPUT CUTLIST"]
workson: []
hugoversion:
relatedfuncs: []
@@ -20,4 +20,4 @@ deprecated: false
```
{{ trim "++Batman--" "+-" }} → "Batman"
```
```
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [strings]
ns:
signature: []
signature: ["truncate SIZE INPUT", "truncate SIZE ELLIPSIS INPUT"]
workson: []
hugoversion: 19
relatedfuncs: []
@@ -24,4 +24,4 @@ Truncate a text to a max length without cutting words or leaving unclosed HTML t
{{% note %}}
If you have a raw string that contains HTML tags you want to remain treated as HTML, you will need to convert the string to HTML using the [`safeHTML` template function](/functions/safehtml) before sending the value to truncate. Otherwise, the HTML tags will be escaped when passed through the `truncate` function.
{{% /note %}}
{{% /note %}}
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-03-12
categories: [functions]
tags: [filtering,lists]
ns:
signature: []
signature: ["union SET1 SET2"]
workson: []
hugoversion: 0.20
relatedfuncs: [intersect,where]
@@ -31,4 +31,4 @@ Given two arrays (or slices) A and B, this function will return a new array that
{{ union nil nil }}
<!-- returns an error because both arrays/slices have to be of the same type -->
```
```
+3 -3
View File
@@ -9,8 +9,8 @@ lastmod: 2017-02-01
tags: [dates,time]
categories: [functions]
ns:
signature: []
workson: []
signature: ["Unix"]
workson: [times]
hugoversion:
relatedfuncs: [Format,dateFormat,now,time]
deprecated: false
@@ -59,4 +59,4 @@ Hugo's output is *static*. In example 2, a month-old page published on a Hugo si
[partial template]: /templates/partials/
[partial template]: /templates/partials/
+1 -1
View File
@@ -10,7 +10,7 @@ tags: []
categories: [functions]
toc:
ns:
signature: []
signature: ["upper INPUT"]
workson: []
hugoversion:
relatedfuncs: []
+2 -2
View File
@@ -9,7 +9,7 @@ categories: [functions]
tags: [urls,strings]
godocref:
ns:
signature: []
signature: ["urlize INPUT"]
hugoversion:
deprecated: false
workson: []
@@ -65,4 +65,4 @@ The preceding partial would then output to the rendered page as follows, assumin
{{% /output %}}
[singletemplate]: /templates/single-page-templates/
[singletemplate]: /templates/single-page-templates/
+2 -2
View File
@@ -9,7 +9,7 @@ lastmod: 2017-02-01
categories: [functions]
tags: [filtering]
ns:
signature: []
signature: ["where COLLECTION KEY [OPERATOR] MATCH"]
workson: [lists,taxonomies,terms,groups]
hugoversion:
relatedfuncs: [intersect,first,after,last]
@@ -136,4 +136,4 @@ Only the following operators are available for `nil`
{{ end }}
```
[intersect]: /functions/intersect/
[intersect]: /functions/intersect/
+1 -1
View File
@@ -9,7 +9,7 @@ lastmod: 2017-03-12
categories: [functions]
tags: [conditionals,fundamentals]
ns:
signature: []
signature: ["with INPUT"]
workson: []
hugoversion:
relatedfuncs: []
@@ -16,4 +16,4 @@
{{ block "addscripts" . }}
{{ end }}
</body>
</html>
</html>
@@ -11,10 +11,13 @@
{{ end }}
</header>
<div class="body-copy" data-section={{.Section | urlize}}>
{{- if eq .Section "functions" -}}
{{- partial "functions-signature.html" . -}}
{{- end -}}
{{.Content}}
</div>
{{- partial "content-footer.html" . -}}
</article>
</main>
{{- partial "table-of-contents.html" . -}}
{{ end }}
{{ end }}
@@ -0,0 +1,9 @@
{{ if isset .Params "signature" -}}
{{- with .Params.signature }}
<pre>
{{- range . }}
{{ . }}
{{- end }}
</pre>
{{- end -}}
{{ end }}
@@ -1,7 +1,7 @@
<nav id="homepage-nav">
<ul class="animated">
<li>
<a href="/about-hugo/">Docs</a>
<a href="/about/">Docs</a>
</li>
<li>
<a href="https://discuss.gohugo.io" target="_blank">Forum</a>