From 322dbf93e7b2475fbad9d76d34dcae1a7e57a6ea Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Fri, 4 Jun 2021 17:29:05 -0700 Subject: [PATCH] Inline favicon The favicon is 175 bytes, smaller than the size of the HTTP headers to fetch it. It can be inlined. Now, pages that don't have any other images need just a single request. --- layouts/partials/head.html | 5 +++-- layouts/shortcodes/indieweb-author.html | 6 ++++-- layouts/shortcodes/indieweb-icon.html | 6 +++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 6fea84d..8ab7a68 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -4,8 +4,9 @@ {{- $icon_192 := resources.Get "/apple-touch-icon.png" | resources.Fingerprint "md5" -}} {{ printf `` $icon_192.RelPermalink | safeHTML }} -{{ $favicon := resources.Get "/favicon.png" | resources.Fingerprint "md5" -}} -{{ printf `` $favicon.RelPermalink | safeHTML -}} +{{ $favicon := resources.Get "/favicon.png" -}} +{{ $favicon_base64 := $favicon.Content | base64Encode }} +{{ printf `` $favicon_base64 | safeHTML -}} diff --git a/layouts/shortcodes/indieweb-author.html b/layouts/shortcodes/indieweb-author.html index c762926..1b00f8e 100644 --- a/layouts/shortcodes/indieweb-author.html +++ b/layouts/shortcodes/indieweb-author.html @@ -1,3 +1,5 @@ -{{ $favicon := resources.Get "/favicon.png" | resources.Fingerprint "md5" -}} - +{{ $favicon := resources.Get "/favicon.png" -}} +{{- $favicon_base64 := $favicon.Content | base64Encode -}} + + diff --git a/layouts/shortcodes/indieweb-icon.html b/layouts/shortcodes/indieweb-icon.html index c8496bb..3b16266 100644 --- a/layouts/shortcodes/indieweb-icon.html +++ b/layouts/shortcodes/indieweb-icon.html @@ -1,3 +1,3 @@ - -{{ $favicon := resources.Get "/favicon.png" | resources.Fingerprint "md5" -}} -Rohan Kumar +{{ $favicon := resources.Get "/favicon.png" -}} +{{- $favicon_base64 := $favicon.Content | base64Encode -}} +Rohan Kumar