mirror of
https://github.com/maikka39/Personal-Website.git
synced 2026-10-02 14:46:25 +00:00
Convert all images to webp when possible
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
{{- $img := resources.Get .path }}
|
||||
{{- $img = $img.Resize (printf "%dx%d webp" $img.Width $img.Height) }}
|
||||
<img src="{{ $img.Permalink }}" alt="{{ .alt | default " " }}" width="{{ .width | default $img.Width }}"
|
||||
height="{{ .height | default $img.Height }}" {{- if .class}}class="{{ .class }}" {{end}}
|
||||
{{- if .style}}style="{{ .style | safeCSS | default " " }}" {{end}} />
|
||||
@@ -2,7 +2,7 @@
|
||||
style="text-decoration: none;">
|
||||
<div class="logo">
|
||||
{{- if .Site.Params.Logo.path }}
|
||||
<img src="{{ .Site.Params.Logo.path }}" alt="{{ .Site.Params.Logo.alt }}" />
|
||||
{{- partial "image.html" (dict "path" .Site.Params.Logo.path "alt" .Site.Params.Logo.alt) }}
|
||||
{{- else }}
|
||||
<span class="logo__mark">></span>
|
||||
<span class="logo__text">{{- with .Site.Params.Logo.logoText }}{{ . }}{{ else }}$ cd /home/{{ end }}<span
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
content="{{ if .IsHome }}{{ .Site.Params.homeSubtitle }}{{ else }}{{ .Params.description | plainify }}{{ end }}" />
|
||||
<meta property="og:url" content="{{ .Permalink }}" />
|
||||
{{- with .Params.cover }}
|
||||
<meta property="og:image" content="{{ . | absURL }}" />
|
||||
{{- $img := imageConfig (printf "static/%s" .) }}
|
||||
{{- $img := resources.Get . }}
|
||||
{{- $img = $img.Resize (printf "%dx%d png" $img.Width $img.Height) }}
|
||||
<meta property="og:image" content="{{ $img.Permalink }}" />
|
||||
<meta property="og:image:width" content="{{ $img.Width }}" />
|
||||
<meta property="og:image:height" content="{{ $img.Height }}" />
|
||||
{{- end }}
|
||||
@@ -49,7 +50,9 @@
|
||||
<!-- Twitter cards -->
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
{{- if .Params.cover }}
|
||||
<meta name="twitter:image" content="{{ .Params.cover | absURL }}" />
|
||||
{{- $img := resources.Get .Params.cover }}
|
||||
{{- $img = $img.Resize (printf "%dx%d png" $img.Width $img.Height) }}
|
||||
<meta name="twitter:image" content="{{ $img.Permalink }}" />
|
||||
<meta name="twitter:image:alt" content="{{ .Params.title | plainify | default " " }}" />
|
||||
{{- end }}
|
||||
<meta name="twitter:title" content="{{ .Title }}" />
|
||||
|
||||
Reference in New Issue
Block a user