One SEO professional asked John Mueller during a hangout about Lazy loading with a facade. They are having trouble getting their pages with JavaScript content indexed, but they know they can use video sitemaps and video structured data.
The way the Lazy loading facade is setup, they dynamically inject the iframe when a user clicks on the play button.
The end result is that articles they have written are not being indexed on the page because of this setup.
Therefore, they were curious about what might be the best way to actually get the content on the page indexed.
John replied that it is highly likely that Google does not recognize that there’s a video, based on the way the SEO pro has their site set up.
John also admitted that the video search team has previously informed him that they should not be telling people to set videos up with JavaScript dynamic injection like this, because of the problems that using this setup can cause.
Ideally, the best approach would be to make sure that the video is marked up with structured data, so that Google can tell that there’s actually a video present.
Additionally, using a video sitemap is recommended so that Google can easily see and understand the video pages that are on your site.
He believes the best approach is a combination of those two approaches: using the sitemap along with the structured data marking up the video.
This happens at approximately the 5:09 mark in the video.
John Mueller Hangout Transcript
SEO Professional 2 5:09
I have a question about JavaScript, SEO and getting JavaScript content indexed. So, So for Core Web Vitals. So I work on a blog website, first of all, and for Core Web Vitals, we have a feature where we put a YouTube video at the top, so that became the LCP element. So it was heavier than when we just had a regular image.
So we’re trying a method where we’re dynamically injecting it– I saw a web dev article that suggested lazy loading with a facade. So since it’s not below the fold content, we don’t lazy load it, but we’re using a facade.
And then the iframe is dynamically injected when the user clicks the play button. I’m realizing now that the articles are not being indexed with the video content on the page, essentially. So if I search for the page, and I go to Video Search, it doesn’t appear there. I’m wondering what the best way to get that content indexed with the page is, I mean, I know I can do things like submit a video sitemap and stuff.
But for it to be, for basically for the video to be seen as related to the webpage, the way that it was indexed before. So is something like noscript or structured data, the way to go is, is there any sort of best practice for this?
John 6:38
Yeah, depending on the the way that you set up the kind of the, the facade that you mentioned there, where you you click on an image, essentially, or a div or something, and then it loads a video in the background, it can definitely be the case that we don’t automatically pick it up as a video, when we view the page.
And I have had feedback from the video search team telling us like we shouldn’t tell people to do this, because it causes problems like that. Essentially, the best approaches there are, at least to make sure that with structured data, we can tell that there’s still a video there.
So I believe there’s a kind of structured data specifically for videos that you can add. A video sitemap is essentially very similar in that regard, in that you’re telling us on this page, there’s a video that is relevant. So those are kind of the two approaches there.
I suspect over time, the YouTube embed will get better and faster. And it’ll be less of an issue where you have to kind of do these tricks. But I think for the moment, it can still make sense. And it can still have a big effect on the Core Web Vitals of a page. So from that point of view, I’m kind of torn.
Like if the video team tells me like, you should put it directly and the other team says like, you should make things fast and like hard to find a middle ground. But I think at least making sure that we can recognize the video is there, that’s really important.
SEO Professional 2 8:13
So for the video object structured data, I think there’s like a guideline, a general structure data guideline that you can’t mark up content that isn’t visible on the page. So could it be potentially seen as misleading? Because Google can’t actually see the video?
John 8:30
I think that’s fine. No, I don’t think you have to worry about that. That’s specifically like if there were no actual video on the page, that would be a problem. And specifically, with text based structured data, that’s something we can try to figure out automatically.
But when it comes to videos, there are lots of different ways of embedding videos and some of the ways to embed videos, we just don’t pick up automatically. And because of that we have the structure data. So from that point of view, that should be fine.
SEO Professional 2 9:01
Okay. And then, if so, I know there’s a few different options here. So I wanted some clarification on the noscript tag, like, I know, that’s recommended for users who don’t have JavaScript on. How does Google handle that? Is it recommended to also include that just for when the page doesn’t get rendered?
John 9:22
We generally ignore the content and the noscript. So that’s, I don’t think that would be a workaround if you’re trying to include something for indexing. So, so from that point of view, I would use the other methods more.