mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-25 15:58:53 +00:00
Clarify context in example of using the try statement
This commit is contained in:
@@ -104,6 +104,9 @@ Instead of failing the build, we can catch the error and emit a warning:
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
```
|
||||
In the above, note that the [context](/getting-started/glossary/#context) within the last conditional block is the `TryValue` object returned by the `try` statement. At this point neither the `Err` nor `Value` methods returned anything, so the current context is not useful. Use the `$` to access the [template context] if needed.
|
||||
|
||||
[template context]: /templates/introduction/#template-context
|
||||
|
||||
{{% note %}}
|
||||
Hugo does not classify an HTTP response with status code 404 as an error. In this case `resources.GetRemote` returns nil.
|
||||
|
||||
Reference in New Issue
Block a user