Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not throw on invalid Vimeo id, render hint instead #55

Merged
merged 1 commit into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions templates/app/config/_default/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ disableHugoGeneratorInject: true
enableRobotsTXT: true
buildDrafts: true
languageCode: en
ignoreErrors:
- error-remote-getjson
defaultContentLanguage: en
defaultContentLanguageInSubdir: true
sitemap:
Expand Down
2 changes: 2 additions & 0 deletions templates/app/config/production/config.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
buildDrafts: false
ignoreErrors:
- error-remote-getjson
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@
{{/* Build player url */}}
{{- $url := print "https://player.vimeo.com/video/" $video_id "?" (delimit $query "&") -}}

{{/* Try to fetch thumbnail & title from vimeo oembed json */}}
{{/* Try getting thumbnail & title from Vimeo oEmbed endpoint */}}
{{- $poster_src := "" -}}

{{- with getJSON "https://vimeo.com/api/oembed.json?url=https://vimeo.com/" $video_id }}
{{/* Try get with & height from oembed to scale the thumbnail */}}
{{/* Access width & height from Vimeo embedcode to scale the thumbnail */}}
{{- $width := 0 -}}
{{- $height := 0 -}}
{{- $factor := 0 -}}
Expand All @@ -87,7 +88,11 @@
{{- with .title -}}
{{- $title = $title | default . -}}
{{- end -}}
{{- end -}}
{{ else }}
{{/* Generate Embedcode failed, possibly due to invalid Vimeo source URL */}}
{{ warnf "Generating Vimeo embedcode failed" }}
<div>Generating Vimdeo embedcode failed. Please make sure to use a valid source URL.</div>
{{ end }}

{{/* Generate srcdoc iframe placholder when autoplay is not enabled */}}
{{- $srcdoc := false -}}
Expand Down