diff --git a/config.toml b/config.toml index 5bc9c12ea..e0e7350f5 100644 --- a/config.toml +++ b/config.toml @@ -29,6 +29,10 @@ target = "assets/js" source = "assets/scss" target = "assets/scss" +[[module.mounts]] +source = "static/img" +target = "assets/img" + # Shortcuts in the docs section [[menu.shortcuts]] name = " Back to GDQuest.com" @@ -102,6 +106,7 @@ privacyEnhanced = true dir = ":cacheDir/modules" maxAge = -1 + [markup] defaultMarkdownHandler = "goldmark" @@ -110,6 +115,7 @@ defaultMarkdownHandler = "goldmark" unsafe = true [module] + [[module.imports]] path = "github.com/gohugoio/hugo-mod-jslibs/instantpage" diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 548c0f51a..9663b1874 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -1 +1,16 @@ -{{ .Text }} +{{ $path := .Destination | safeURL }} +{{ $alt := .Text }} +{{ $resource := .Page.Resources.GetMatch .Destination }} + +{{ with $resource }} + {{ if and (eq .ResourceType "image") (ne .MediaType.SubType "svg") }} + {{ $alt }} + {{ else }} + $alt + {{ end }} +{{ end }}