summaryrefslogtreecommitdiffstats
path: root/docs/content/en/functions
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-09-13 20:34:24 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-09-13 20:34:24 +0200
commitaf23cdca9c9c230ffbffbab96f9600a78c76b75f (patch)
tree295143582c22fbac26978fc12f027ca497493fb8 /docs/content/en/functions
parentab5ce59894520a796ca658ef0385c65c2fa45f99 (diff)
parent90ad8045056167004d27857a95542936657b8a16 (diff)
Diffstat (limited to 'docs/content/en/functions')
-rw-r--r--docs/content/en/functions/RenderString.md2
-rw-r--r--docs/content/en/functions/i18n.md23
-rw-r--r--docs/content/en/functions/images/index.md2
-rw-r--r--docs/content/en/functions/slice.md4
-rw-r--r--docs/content/en/functions/union.md4
5 files changed, 29 insertions, 6 deletions
diff --git a/docs/content/en/functions/RenderString.md b/docs/content/en/functions/RenderString.md
index 1b77f6a38..e414b11ca 100644
--- a/docs/content/en/functions/RenderString.md
+++ b/docs/content/en/functions/RenderString.md
@@ -14,8 +14,6 @@ signature: [".RenderString MARKUP"]
`.RenderString` is a method on `Page` that renders some markup to HTML using the content renderer defined for that page (if not set in the options).
-*Note* that this method does not parse and render shortcodes.
-
The method takes an optional map argument with these options:
display ("inline")
diff --git a/docs/content/en/functions/i18n.md b/docs/content/en/functions/i18n.md
index 7d88292b9..34a6ff022 100644
--- a/docs/content/en/functions/i18n.md
+++ b/docs/content/en/functions/i18n.md
@@ -18,7 +18,7 @@ deprecated: false
aliases: []
---
-This translates a piece of content based on your `i18n/en-US.yaml` (and similar) files. You can use the [go-i18n](https://github.com/nicksnyder/go-i18n) tools to manage your translations. The translations can exist in both the theme and at the root of your repository.
+This translates a piece of content based on your `i18n/en-US.toml` files. You can use the [go-i18n](https://github.com/nicksnyder/go-i18n) tools to manage your translations. The translations can exist in both the theme and at the root of your repository.
```
{{ i18n "translation_id" }}
@@ -28,6 +28,27 @@ This translates a piece of content based on your `i18n/en-US.yaml` (and similar)
`T` is an alias to `i18n`. E.g. `{{ T "translation_id" }}`.
{{% /note %}}
+### Query a flexible translation with variables
+
+Often you will want to use the page variables in the translation strings. To do so, pass the `.` context when calling `i18n`:
+
+```
+{{ i18n "wordCount" . }}
+```
+
+The function will pass the `.` context to the `"wordCount"` id:
+
+{{< code-toggle file="i18n/en-US" >}}
+[wordCount]
+other = "This article has {{ .WordCount }} words."
+{{< /code-toggle >}}
+
+Assume `.WordCount` in the context has value is 101. The result will be:
+
+```
+This article has 101 words.
+```
+
For more information about string translations, see [Translation of Strings in Multilingual Mode][multistrings].
[multistrings]: /content-management/multilingual/#translation-of-strings
diff --git a/docs/content/en/functions/images/index.md b/docs/content/en/functions/images/index.md
index 92c6ff0da..7dd5843ee 100644
--- a/docs/content/en/functions/images/index.md
+++ b/docs/content/en/functions/images/index.md
@@ -218,6 +218,8 @@ Also see the [Filter Method](/content-management/image-processing/#filter).
Parses the image and returns the height, width, and color model.
+The `imageConfig` function takes a single parameter, a file path (_string_) relative to the _project's root directory_, with or without a leading slash.
+
{{% funcsig %}}
images.ImageConfig PATH
{{% /funcsig %}}
diff --git a/docs/content/en/functions/slice.md b/docs/content/en/functions/slice.md
index 0710d5e40..24b717128 100644
--- a/docs/content/en/functions/slice.md
+++ b/docs/content/en/functions/slice.md
@@ -23,7 +23,9 @@ toc: false
One use case is the concatenation of elements in combination with the [`delimit` function][]:
{{< code file="slice.html" >}}
-{{ delimit (slice "foo" "bar" "buzz") ", " }}
+{{ $sliceOfStrings := slice "foo" "bar" "buzz" }}
+<!-- returns the slice [ "foo", "bar", "buzz"] -->
+{{ delimit ($sliceOfStrings) ", " }}
<!-- returns the string "foo, bar, buzz" -->
{{< /code >}}
diff --git a/docs/content/en/functions/union.md b/docs/content/en/functions/union.md
index 459e3620d..465abcdd8 100644
--- a/docs/content/en/functions/union.md
+++ b/docs/content/en/functions/union.md
@@ -40,8 +40,8 @@ This is also very useful to use as `OR` filters when combined with where:
```
{{ $pages := where .Site.RegularPages "Type" "not in" (slice "page" "about") }}
-{{ $pages := $pages | union (where .Site.RegularPages "Params.pinned" true) }}
-{{ $pages := $pages | intersect (where .Site.RegularPages "Params.images" "!=" nil) }}
+{{ $pages = $pages | union (where .Site.RegularPages "Params.pinned" true) }}
+{{ $pages = $pages | intersect (where .Site.RegularPages "Params.images" "!=" nil) }}
```
The above fetches regular pages not of `page` or `about` type unless they are pinned. And finally, we exclude all pages with no `images` set in Page params.