I've got picture gallery on my website that contains few hundreds of images. These are miniatures that are enlarged when have been clicked. The images are well optimized (they are compressed using one of online tools and also a webp version is included). All the images have got alt description that contains keywords relevant to my site, and also file names contain the keywords (the images present some products that are named in alts and filenames).

Unfortunately when I check my website with Page Speed Insights tool the result of test is relatively poor and it warns me, that my DOM is too large. So I've got a question: What would be better (taking into account SEO performance): to load part of DOM with javascript when some trigger happens (i.e. scroll or pressing the button) or to leave it as it is (and maybe add some lazy loading for the images - however miniatures are of very small size, so lazy loading will not help too much, and first of all lazyloading will not reduce the number of DOM nodes)?

Are keywords in alternate texts and filenames of greater importance than the size of the DOM? I know that only Google can know it, but maybe someone has had same situation and is able to share her/his experiences.

And I've got another doubt. As can be read in https://support.google.com/webmasters/answer/35769?hl=en#quality_guidelines google bot can read inside js files. But what if I would like to gernerate html code in js using for statement and a table with file names. That would produce much shorter code to be loaded, but would google bot understand all content (i.e. alts produced by conversion of filenames)?

Another doubt: I could load this js script asynchronously, because it will not be required until someone takes the action to fire the trigger. It would be very good for loading performance, but wouldn't that make it difficult for google bot to look inside it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.