Skip to content

Commit

Permalink
feat(plugin): add loading=lazy to image
Browse files Browse the repository at this point in the history
  • Loading branch information
bmuenzenmeyer committed Feb 25, 2023
1 parent 0efe86d commit 89550ea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = (eleventyConfig, options) => {
}

eleventyConfig.addPairedShortcode("ai", function (content, href, size = 128) {
return `<a href="${href}"><img alt="favicon for ${href}" style="max-height: 1em; position: relative; top: .2em; margin-right: .2em" src="${SERVICE_BASE.replace("%%URL%%", href).replace("%%SIZE%%", size)}"/>${content}</a>`
return `<a href="${href}"><img alt="favicon for ${href}" loading="lazy" style="max-height: 1em; position: relative; top: .2em; margin-right: .2em" src="${SERVICE_BASE.replace("%%URL%%", href).replace("%%SIZE%%", size)}"/>${content}</a>`
})

eleventyConfig.addFilter("ai", (href, text) => {
Expand All @@ -15,7 +15,7 @@ module.exports = (eleventyConfig, options) => {
...options,
}

return `<a href="${href}"><img alt="favicon for ${href}" style="max-height: 1em; position: relative; top: .2em; margin-right: .2em" src="${SERVICE_BASE.replace(
return `<a href="${href}"><img alt="favicon for ${href}" loading="lazy" style="max-height: 1em; position: relative; top: .2em; margin-right: .2em" src="${SERVICE_BASE.replace(
"%%URL%%",
href
).replace("%%SIZE%%", size)}"/>${text}</a>`
Expand Down

0 comments on commit 89550ea

Please sign in to comment.