mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
e4d6ec94b5
In Hugo 0.90.0 we introduced remote support in `resources.Get`. But with remote resources comes with a higher chance of failing a build (network issues, remote server down etc.). Before this commit we always failed the build on any unexpected error. This commit allows the user to check for any error (and potentially fall back to a default local resource): ```htmlbars {{ $result := resources.Get "https://gohugo.io/img/hugo-logo.png" }} {{ with $result }} {{ if .Err }} {{/* log the error, insert a default image etc. *}} {{ else }} <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt=""> {{ end }} {{ end }} ``` Note that the default behaviour is still to fail the build, but we will delay that error until you start using the `Resource`. Fixes #9529 |
||
---|---|---|
.. | ||
page_generate | ||
pagemeta | ||
page.go | ||
page_author.go | ||
page_data.go | ||
page_data_test.go | ||
page_kinds.go | ||
page_kinds_test.go | ||
page_marshaljson.autogen.go | ||
page_matcher.go | ||
page_matcher_test.go | ||
page_nop.go | ||
page_outputformat.go | ||
page_paths.go | ||
page_paths_test.go | ||
page_wrappers.autogen.go | ||
pagegroup.go | ||
pagegroup_test.go | ||
pages.go | ||
pages_cache.go | ||
pages_cache_test.go | ||
pages_language_merge.go | ||
pages_prev_next.go | ||
pages_prev_next_test.go | ||
pages_related.go | ||
pages_related_test.go | ||
pages_sort.go | ||
pages_sort_search.go | ||
pages_sort_search_test.go | ||
pages_sort_test.go | ||
pages_test.go | ||
pagination.go | ||
pagination_test.go | ||
permalinks.go | ||
permalinks_test.go | ||
site.go | ||
testhelpers_test.go | ||
weighted.go | ||
zero_file.autogen.go |