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

Give indieweb icon a PNG fallback

This should improve compatibility with older and non-mainstream
browsers.
This commit is contained in:
Rohan Kumar 2022-06-09 08:34:49 -07:00
parent 48a9088ca1
commit bd705cd0b1
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
3 changed files with 11 additions and 6 deletions

View file

@ -338,7 +338,7 @@ pre {
/* center standalone images; same justification as
* for centering the body contents. Also makes images easier to see
* for people holding a device with one hand. */
picture > img {
div[itemprop="articleBody"] img {
display: block;
height: auto;
margin: auto;

View file

@ -1,9 +1,14 @@
{{ $favicon := resources.Get "/favicon.png" -}}
{{- $favicon_base64 := $favicon.Content | base64Encode -}}
{{- $favicon_bigpng := resources.Get "/favicon192.png" | resources.Fingerprint "md5" -}}
{{- $favicon_svg := resources.Get "/favicon.svg" | resources.Fingerprint "md5" -}}
{{- if in site.BaseURL ".onion" -}}
<img itemprop="image" class="u-photo photo" width="16" height="16" alt=""
{{ if in site.BaseURL ".onion" -}}
src="data:image/png;base64,{{ $favicon_base64 }}"
src="data:image/png;base64,{{ $favicon_base64 }}" />
{{- else -}}
src="{{ $favicon_svg.RelPermalink }}"
{{- end }} />
<picture itemprop="image">
<source srcset="{{ $favicon_svg.RelPermalink }}" type="image/svg+xml" />
<img class="u-photo photo" width="16" height="16" alt=""
src="{{ $favicon_bigpng.RelPermalink }}" />
</picture>
{{- end -}}

View file

@ -34,7 +34,7 @@ sed 7d "$html_file" | xmllint --format --encode UTF-8 --noent - | sd '^\t' '' >"
| sd '<pre(?: tabindex="0")?>\n\t*<code ' '<pre tabindex="0"><code ' \
| sd '(?:\n)?</code>\n(?:[\t\s]*)?</pre>' '</code></pre>' \
| sd '</span>.span itemprop="familyName"' '</span> <span itemprop="familyName"' \
| sd '(<img itemprop="image" class="u-photo photo"[^>]*/>)<span' '$1 <span' \
| sd '</picture><span itemprop="name" class="p-name fn n">' '</picture> <span itemprop="name" class="p-name fn n">' \
| sd '([a-z])<(data|time)' '$1 <$2'
} >>"$xhtml_file"