Merge commit '8b9803425e63e1b1801f8d5d676e96368d706722'

This commit is contained in:
Bjørn Erik Pedersen
2024-06-21 09:41:24 +02:00
475 changed files with 7408 additions and 4720 deletions

View File

@@ -11,21 +11,21 @@ action:
signatures: [SHORTCODE.Position]
---
The `Position` method is useful for error reporting. For example, if your shortcode requires a "greeting" parameter:
The `Position` method is useful for error reporting. For example, if your shortcode requires a "greeting" argument:
{{< code file=layouts/shortcodes/myshortcode.html >}}
{{ $greeting := "" }}
{{ with .Get "greeting" }}
{{ $greeting = . }}
{{ else }}
{{ errorf "The %q shortcode requires a 'greeting' parameter. See %s" .Name .Position }}
{{ errorf "The %q shortcode requires a 'greeting' argument. See %s" .Name .Position }}
{{ end }}
{{< /code >}}
In the absence of a "greeting" parameter, Hugo will throw an error message and fail the build:
In the absence of a "greeting" argument, Hugo will throw an error message and fail the build:
```text
ERROR The "myshortcode" shortcode requires a 'greeting' parameter. See "/home/user/project/content/about.md:11:1"
ERROR The "myshortcode" shortcode requires a 'greeting' argument. See "/home/user/project/content/about.md:11:1"
```
{{% note %}}