@blablabla, please read Requesting Help and share your code. Please don’t create new threads until you’ve done so, because we can’t help otherwise, okay?
For instance, we need to see how you are rendering the data in your template to inform you of how to accomplish your goal. So share that project.
i’m unable to share everything presently, as the code is for someone else, but soon we will be able to open-source it. for now, here is my dilemma, expressed as best as i can:
my data files look like this:
title: Mukundamala
venue: La Kaje, New York City
vernissage: 2018-11-18
finissage: 2018-11-18
what: perf
youtube: https://www.youtube.com/watch?v=FhAXkVFIgN4
and in the layout folder, part of my template for “performances” under “single.html” looks like:
{{ if .youtube }}
<section>
<iframe width="100%" height="315" src="{{.youtube}}"></iframe>
</section>
{{ end }}
this shows up in the page source, when i hit “view source”. however, i see an outline of the iframe but no actual content
/* in your videos.yaml data file */
video:
- title: Mukundamala
venue: La Kaje, New York City
vernissage: 2018-11-18
finissage: 2018-11-18
what: perf
youtube: FhAXkVFIgN4
/* in your single.html */
{{ range .Site.Data.videos.video }}
{{ .title }}
<iframe width=854 height=480 src="https://www.youtube.com/embed/{{ .youtube }}?html5=1" allowfullscreen></iframe>
{{ end }}
I don’t know youtube’s API, but I think for iframe you have to use the “embed” syntax.
You can use the replace funcion to change the url or remove “https://www.youtube.com/watch?v=” to get the id
i tried this, and the result is not different from my data file setup. is this a cross-origin problem? is it because i’m hosting on netlify? i dunno cos i don;t see it rendering locally neither.