1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-23 12:52:10 +00:00

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.
This commit is contained in:
Rohan Kumar 2021-06-04 17:29:05 -07:00
parent 55d99287b4
commit 322dbf93e7
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
3 changed files with 10 additions and 7 deletions

View file

@ -4,8 +4,9 @@
<meta name="author" content="{{ .Site.Author.name }}">
{{- $icon_192 := resources.Get "/apple-touch-icon.png" | resources.Fingerprint "md5" -}}
{{ printf `<link rel="icon" sizes="192x192" href="%s" type="image/png">` $icon_192.RelPermalink | safeHTML }}
{{ $favicon := resources.Get "/favicon.png" | resources.Fingerprint "md5" -}}
{{ printf `<link rel="icon" sizes="32x32" href="%s" type="image/png">` $favicon.RelPermalink | safeHTML -}}
{{ $favicon := resources.Get "/favicon.png" -}}
{{ $favicon_base64 := $favicon.Content | base64Encode }}
{{ printf `<link rel="icon" sizes="32x32" href="data:image/png;base64,%s" type="image/png">` $favicon_base64 | safeHTML -}}
<!-- apple-touch-icon used to be apple-specific, but now it's
a pseudo-standard relied upon by other vendors too:
https://html.spec.whatwg.org/multipage/semantics.html#attr-link-sizes -->

View file

@ -1,3 +1,5 @@
<!-- re-using the indefinetly-cached favicon to avoid bloating page size -->
{{ $favicon := resources.Get "/favicon.png" | resources.Fingerprint "md5" -}}
<span itemprop="author" class="h-card p-author vcard"><a href="https://seirdy.one" rel="author home" class="u-url url"><img class="u-photo photo" src="{{ $favicon.RelPermalink }}" width="16" height="16" alt="Rohan Kumar" > <span class="p-name fn n"><span class="p-given-name given-name">Rohan</span> <span class="p-family-name family-name">Kumar</span></span></a></span>
{{ $favicon := resources.Get "/favicon.png" -}}
{{- $favicon_base64 := $favicon.Content | base64Encode -}}
<span itemprop="author" class="h-card p-author vcard"><a href="https://seirdy.one" rel="author home" class="u-url url"><img class="u-photo photo" src="data:image/png;base64,{{ $favicon_base64 }}" width="16" height="16" alt="Rohan Kumar"> <span class="p-name fn n"><span class="p-given-name given-name">Rohan</span> <span class="p-family-name family-name">Kumar</span></span></a></span>

View file

@ -1,3 +1,3 @@
<!-- re-using the indefinetly-cached favicon to avoid bloating page size -->
{{ $favicon := resources.Get "/favicon.png" | resources.Fingerprint "md5" -}}
<img class="u-photo photo" src="{{ $favicon.RelPermalink }}" width="16" height="16" alt="Rohan Kumar">
{{ $favicon := resources.Get "/favicon.png" -}}
{{- $favicon_base64 := $favicon.Content | base64Encode -}}
<img class="u-photo photo" src="data:image/png;base64,{{ $favicon_base64 }}" width="16" height="16" alt="Rohan Kumar">