diff --git a/config.toml b/config.toml index 5bc9c12ea..928b0de06 100644 --- a/config.toml +++ b/config.toml @@ -102,6 +102,7 @@ privacyEnhanced = true dir = ":cacheDir/modules" maxAge = -1 + [markup] defaultMarkdownHandler = "goldmark" @@ -110,9 +111,18 @@ defaultMarkdownHandler = "goldmark" unsafe = true [module] + [[module.imports]] path = "github.com/gohugoio/hugo-mod-jslibs/instantpage" +[[module.mounts]] +source = "assets/scss" +target = "assets/scss" + +[[module.mounts]] +source = "static/img" +target = "assets/img" + [languages] [languages.en] languageName = "English" diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 548c0f51a..52c813f3e 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -1 +1,51 @@ -{{ .Text }} + +{{ $src := ( .Destination | safeURL ) }} +{{ $fragments := ( split $src "#" ) }} +{{ $src = index ($fragments ) 0 }} +{{ $src = path.Base $src }} +{{ $resource := ($.Page.Resources.ByType "image").GetMatch ( printf "**%s" $src ) }} + +{{ with $resource }} +{{ if (eq .MediaType.SubType "svg") }} + {{ warnf "%q" .Permalink }} +{{ else }} + {{ .ResourceType }} || {{ .MediaType.SubType}} || {{.Width}} +{{ end }} +{{ end }} + +{{ with $resource }} +{{ warnf "%q %s" . .ResourceType }} + {{ if eq .ResourceType "image" }} + {{ $width := 0 }} + {{ $height := 0 }} + {{ if isset . "Width" }} + {{ $width = .Width }} + {{ $height = .Height }} + {{ end }} + + {{ $resized := cond (lt .Width "800") . ( .Resize "800x" ) }} + + {{ $placeholder := "" }} + {{ if eq .MediaType.SubType "jpeg" }} + {{ $placeholder = .Resize "16x q20 jpg Gaussian" }} + {{ end }} + {{ $.Text }} + {{ end }} +{{ else }} + {{ .Text }} +{{ end }}