Add lazy loading of images in Jekyll posts
Normally you define images with ![]()
in markdown files. But jekyll also
provides a way to adding custom attributes to tags with {:attr="value"}
.
If you have lots of posts this command will append `` to all images in all your markdown files.
![image-title](/path/to/your/image.jpg)
will become
![image-title](/path/to/your/image.jpg)
Shell line bellow. Go into the folder where your posts are (probably _posts
).
find . -type f -name "*.md" -exec sed -i -E 's/(\!\[.*\]\((.*?)\))$/\1/' {} \;
Under the hood this adds loading="lazy"
to HTML img
nodes.
That is about it.
Other notes
- c Write and read structs to/from files in C
- plan9 Drawing Pixels in Plan9
- Cronjobs on Github with Github Actions
- Display xterm color palette
- dcss Sane default for Dungeon Crawl Stone Soup Online edition
- Push to multiple origins at once in Git
- plan9 Mount Plan9 over network
- Easy measure time took in a bash script
- Development environments with Nix
- vim Personal sane Vim defaults
- Simple presentations with Markdown
- Making cgit look nicer
- Execute not blocking async shell command in C#
- c Embedding resources into binary with C
- Make B/W SVG charts with matplotlib