Zach’s ugly mug (his face) Zach Leat­herman

CSS-only External Link Favicons

2k 02 January 21, 2022

Saw a fascinating idea in a tweet from @simevidas to show favicons on external links on a site. Full credit for the original idea to Kiko Beats.

The implementation used an icon font to store the favicons. I think we can improve on this idea (do y’all want to maintain an icon font 😅) to save some future maintenance using IndieWeb Avatar. This will allow the images to auto-update when a site updates their favicon (per server caching rules).

Add this CSS to see it in action:

a[href^="https://twitter.com"]:before {
  content: "";
  display: inline-flex;
  vertical-align: text-bottom;
  width: 1em;
  height: 1em;
  background-size: contain;
  background-image: url("https://v1.indieweb-avatar.11ty.dev/https%3A%2F%2Fwww.twitter.com%2F/");
}

Demo

Bonus

Add <link href="https://v1.indieweb-avatar.11ty.dev" rel="preconnect" crossorigin> if these images are in your critical rendering path (tip: you should try to not do this).


< Older
Eleventy v1.0.0, the stable release.
Newer >
Trailing Slashes on URLs: Contentious or Settled?

Zach Leatherman IndieWeb Avatar for https://zachleat.com/is a builder for the web at Font Awesome and the creator of Build Awesome (née IndieWeb Avatar for https://www.11ty.devEleventy/11ty), an award-winning open source website generator. He measures website performance with speedlify and at one point became too fixated on web fonts. He has given 89 talks in nine different countries at events like Beyond Tellerrand, Smashing Conference, Jamstack Conf, CSSConf, and The White House. Formerly part of CloudCannon, Netlify, Filament Group, NEJS CONF, and NebraskaJS. Learn more about Zach »

2 Likes
SergioDaniel Zenzes
2 Comments
  1. David Bushell ????
    David Bushell ????

    @zachleat could I interest you in my new favicon-as-a-service startup ????

  2. Zach Leatherman :11ty:
    Zach Leatherman :11ty:

    @db @Edent had a few listed on their latest blog post: https://shkspr.mobi/blog/2025/10/a-self-hosted-favicon-proxy-written-in-php/ A Self-Hosted Favicon Proxy written in PHP

Shamelessly plug your related post

These are webmentions via the IndieWeb and webmention.io.

Sharing on social media?

This is what will show up when you share this post on Social Media:

How did you do this? I automated my Open Graph images. (Peer behind the curtain at the test page)