aboutsummaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/baseof.html4
-rw-r--r--layouts/shortcodes/img.html26
2 files changed, 8 insertions, 22 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 974affa..d6ad48b 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -7,10 +7,10 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
{{ $css := resources.Match "stylesheets/*.css" | resources.Concat "style.css" | minify | fingerprint }}
- <link rel="stylesheet" href="{{ $css.Permalink }}">
+ <link type="text/css" rel="stylesheet" href="{{ $css.Permalink }}">
{{ with $.Resources.GetMatch "**.css*" }}
{{ $style := . | minify | fingerprint }}
- <link type=text/css rel="stylesheet" href="{{ $style.Permalink }}">
+ <link type="text/css" rel="stylesheet" href="{{ $style.Permalink }}">
{{ end }}
{{- block "head" . }}{{- end }}
</head>
diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html
index a57e1ed..e2a5db9 100644
--- a/layouts/shortcodes/img.html
+++ b/layouts/shortcodes/img.html
@@ -1,34 +1,20 @@
<!-- https://gohugo.io/content-management/image-processing/ -->
<!-- Get image -->
-{{- $image := resources.GetMatch (.Get "src") -}}
+{{- $image := .Page.Resources.Get (.Get "src") -}}
<!-- Get parameters -->
{{- $alt := .Get "alt" | default "" -}}
{{- $caption := .Get "caption" | default "" -}}
-{{- $rotation := .Get "rotation" | default 0 -}}
-
-<!-- Get quality -->
-{{- $quality := .Get "quality" | default "original" -}}
-
-<!-- Apply quality settings -->
-{{- $q := 0 -}}
-{{- $size := 0 -}}
-{{- if eq $quality "low" -}}
- {{- $q = 60 -}}
- {{- $size = 600 -}}
-{{- else if eq $quality "medium" -}}
- {{- $q = 75 -}}
- {{- $size = 1000 -}}
-{{- else if eq $quality "high" -}}
- {{- $q = 90 -}}
- {{- $size = 1200 -}}
-{{- end -}}
+{{- $rotate := .Get "rotate" | default 0 -}}
+{{- $quality := .Get "quality" | default 90 -}}
+{{- $size := .Get "size" | default 1200 -}}
<!-- Make image -->
{{- if ne $quality "original" -}}
- {{- $image = $image.Resize (printf "%dx q%d r%d" $size $q $rotation) -}}
+ {{- $image = $image.Resize (printf "%dx q%d r%d" $size $quality $rotate) -}}
{{- end -}}
+<!-- TODO add multiple quality/fallback options + webp -->
<figure>
<img src="{{ $image.RelPermalink }}" title="{{ $alt }}" alt="{{ $alt }}" />
{{- if ne $caption "" -}}