jsoxford / jsnotoxfordsite

MIT License
0 stars 1 forks source link

Create filter to turn default youtube embed links into noocookie ones #15

Closed javorszky closed 3 years ago

javorszky commented 3 years ago

Source: https://github.com/jsoxford/jsnotoxfordsite/pull/13#pullrequestreview-588041785

Turn

https://www.youtube.com/embed/m8iMGFjVgGg

into

https://www.youtube-nocookie.com/embed/m8iMGFjVgGg

Make a filter for it per https://www.11ty.dev/docs/filters/

omgmog commented 3 years ago

Also handle these sort of links:

https://www.youtube.com/watch?v=m8iMGFjVgGg

to become:

https://www.youtube-nocookie.com/embed/m8iMGFjVgGg

Also yeah the filter should be straight forward to setup, examples of the ones I've added are here: https://github.com/jsoxford/jsnotoxfordsite/blob/main/.eleventy.js#L29-L43

They are then just used when outputting a value, e.g. you might have a filter called yt and use it like:

{{ stream | yt }}