Are the "Exclude options" (tab) supposed to work?

I tried excluding a single page via this tab, by using the "Pages" vertical tab and entering the path in the format "/mypage". It wasn't clear if I should use "Show for the listed pages" or "Hide for the listed pages" ("hide" seems more intuitive), so I tried both. In both cases, it seems lazyloading was then disabled on all pages of my site.

What's more, removing this condition (i.e. emptying this field) did not revert the situation, and lazyloading remained disabled on all pages. Clearing all caches (via Drush or the admin) didn't help either. I had to uninstall and reinstall the module to get lazyloading to work again.

Note: when disabled (because excluded), the <noscript> tag (containing the normal <img> tag) was still present in the source code, which seems unnecessary and potentially problematic. (I imagine this would lead browsers with javascript disabled to display each image twice.)

Tested on the following versions:
8.x-1.0-alpha2+8-dev
8.x-1.0-alpha2+12-dev

and Drupal 8.3.7

Comments

s427 created an issue. See original summary.

fgm’s picture

I think #2892753: Add hook lazyloader_image_ignore might be both simpler to use and more generic.

OTOH it is only for coders...

jenlampton’s picture

Exclude options don't work on the 7.x branch of the module either.

mattwmc’s picture

Yes, I'm having the same problem on D7 trying to exclude admin pages.

fox mulder’s picture

same here

image_lazyload version: 8.x-1.0-alpha2+12-dev
drupal core version: 8.5.6

m_z’s picture

I came to the same strange observation, that after saving the '/admin/config/media/lazyloader/exclude' config form lazyload was disabled for all images.

But then I saw the vertical tab 'Current theme' that was pointing to my admin theme / backend theme.
After switching that setting to the frontend theme and re-saving the config, everything worked as it should.

Naming the form 'Exclude' is not good, because the 'Visibility' block is not for excluding, but for including the lazyload functionality - as far as I can see...

But by the way: the (old?) 'paths' config setting isn't available in the exclude config form backend any more. But it is still in the https://cgit.drupalcode.org/lazyloader/tree/config/schema/lazyloader.sch... + https://cgit.drupalcode.org/lazyloader/tree/config/install/lazyloader.ex...

That should be cleaned, or not?

EDIT:

I created a issue to clean up the config settings: #3017664: The (old) 'paths' configuration setting isn't used in code any longer

m_z’s picture

heyddi’s picture

In case that helps for d7, I created this patch that allowed me to make the excluded files works : https://www.drupal.org/project/lazyloader/issues/2904825

m_z’s picture

@heyddi: Thanks for your comment, but the D8 configuration seems to be completely re-factored (compared to the D7 configuration).