title: My title
description: My description
#summary: <iframe width="560" height="315" src="https://www.youtube.com/embed/...." frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/...." frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
Some text here
Note I’ve commented out the summary. If I uncomment it, I see the YouTube video fine in the summary, but obviously not the text.
If I leave the summary commented out, I see my text, but not iframe/video.
I’ve also tried with a shortcode.
So far as I can tell from your proposed solution, you’re saying the .summary var just doesn’t contain the iframe, and there’s no way to get it in there? So I just need a special conditional in the summary partial (as I don’t necessarily have a youtube video).
If that’s the case, the position will no longer be the same as in the post itself right, unless I always put it at the top.
By default, Hugo automatically takes the first 70 words of your content as its summary and stores it into the .Summary page variable for use in your templates. You may customize the summary length by setting summaryLength in your site configuration.
I feel like having video content in the summary must be a common use case, so I’m surprised it doesn’t work at all out of the box.
Your solution seems to assume a youtube embed code is treated specially, and will be just placed in the summary partial if it’s there. But that disconnects it from the layout in the post, where you might want a line of text beforehand.