mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-24 21:56:05 +02:00
tpl: Use erroridf for remote YouTube errors
So they can be silenced. Fixes #12383
This commit is contained in:
@@ -22,6 +22,7 @@ Renders an embedded YouTube video.
|
|||||||
*/}}
|
*/}}
|
||||||
|
|
||||||
{{- $pc := .Page.Site.Config.Privacy.YouTube }}
|
{{- $pc := .Page.Site.Config.Privacy.YouTube }}
|
||||||
|
{{- $remoteErrID := "err-youtube-remote" }}
|
||||||
{{- if not $pc.Disable }}
|
{{- if not $pc.Disable }}
|
||||||
{{- with $id := or (.Get "id") (.Get 0) }}
|
{{- with $id := or (.Get "id") (.Get 0) }}
|
||||||
|
|
||||||
@@ -31,12 +32,12 @@ Renders an embedded YouTube video.
|
|||||||
{{- $data := dict }}
|
{{- $data := dict }}
|
||||||
{{- with resources.GetRemote $url }}
|
{{- with resources.GetRemote $url }}
|
||||||
{{- with .Err }}
|
{{- with .Err }}
|
||||||
{{- errorf "The %q shortcode was unable to get remote resource %q. %s. See %s" $.Name $url . $.Position }}
|
{{- erroridf $remoteErrID "The %q shortcode was unable to get remote resource %q. %s. See %s" $.Name $url . $.Position }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- $data = .Content | transform.Unmarshal }}
|
{{- $data = .Content | transform.Unmarshal }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- errorf "The %q shortcode was unable to get remote resource %q. See %s" $.Name $url $.Position }}
|
{{- erroridf $remoteErrID "The %q shortcode was unable to get remote resource %q. See %s" $.Name $url $.Position }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{/* Set defaults. */}}
|
{{/* Set defaults. */}}
|
||||||
|
Reference in New Issue
Block a user