Use native lazy loading and a two-column pictures grid
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
require 'nokogiri'
|
||||
|
||||
module LazyImages
|
||||
def lazy_images(content)
|
||||
fragment = Nokogiri::HTML::DocumentFragment.parse(content)
|
||||
fragment.css('img').each { |image| image['loading'] = 'lazy' }
|
||||
fragment.to_html
|
||||
end
|
||||
end
|
||||
|
||||
Liquid::Template.register_filter(LazyImages)
|
||||
Reference in New Issue
Block a user