jungvonmatt / wekit

A Jamstack kit for Contentful, Hugo and Netlify.
https://www.wekit.dev
MIT License
14 stars 4 forks source link

Make Vimeo embed logic more robust #54

Closed psolbach closed 1 year ago

psolbach commented 1 year ago

Our Vimeo oEmbed template logic will throw on build/deployment, if editors enter an invalid source URL in the CMS. We should construct it in such a way that the site still builds and the editor then sees a broken video embed.

This template code in embed-video.html fails if the source URL does not contain valid Vimeo link structure, like e.g. https://vimeo.com/foo/barf

{{- with getJSON "https://vimeo.com/api/oembed.json?url=https://vimeo.com/"  $video_id }}
psolbach commented 1 year ago

How to quickly fix this: https://github.com/gohugoio/hugo/issues/7228#issuecomment-714529686

psolbach commented 1 year ago

PR is here https://github.com/jungvonmatt/wekit/pull/55

dlemm commented 1 year ago

PR #55 is merged. The issue can be closed?