martignoni / hugo-video

A Hugo theme component to embed videos using HTML video element
GNU General Public License v3.0
105 stars 27 forks source link

Wrong download link when using shortcode multiple times on same page #3

Closed OlafHaag closed 4 years ago

OlafHaag commented 4 years ago

When I embed multiple videos on the same page using the shortcode, a message is displayed below the one of the videos linking to a download of the first video, regardless whether it's unsupported or not. I can't quite predict below which video the message will appear.

martignoni commented 4 years ago

I'm unable to reproduce this. This shortcode doesn't output any link to the displayed video.

Please share your code.

OlafHaag commented 4 years ago

My repo isn't pushed to a public available upstream, unfortunately.

I have a file structure like this:

content\
|__english\
    |__blog\
        |__myfirstentry\
            |__vid\
                |__vid01.m4v
                |__vid02.m4v
                |__vid03.m4v
                |__vid04.m4v
            |__index.md

in index.md:

{{< video src="vid/vid01" autoplay="true" loop="true" mute="true" >}}
{{< video src="vid/vid02" autoplay="true" loop="true" mute="true" >}}
{{< video src="vid/vid03" autoplay="true" loop="true" mute="true" >}}
{{< video src="vid/vid04" autoplay="true" loop="true" mute="true" >}}

It renders all the videos, but somewhere (unpredictable below which) it renders this with a link to the first video (vid01.m4v): https://github.com/martignoni/hugo-video/blob/0774536f94263792c032ae00c3277aaf97e4c8e8/i18n/en.yaml#L2

martignoni commented 4 years ago

I can't reproduce this. Could you please confirm that it still occurs with recent fixes?

OlafHaag commented 4 years ago

I looked into it some more and came to the conclusion that this is not a bug caused by this shortcode, but by either hugo itself or the theme that I'm using.

The solution to the problem is simply to separate each video shortcode by an empty line. Otherwise the first video tag of a bunch (not seperated) will be put inside a <p> tag and the text in the video tag will be pulled out and put below it.