diff options
author | Martin Fischer <martin@push-f.com> | 2025-08-16 22:32:26 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2025-08-16 22:32:26 +0200 |
commit | 0417a92524d58685b328a6cfa650d06e931ad054 (patch) | |
tree | bc47699fa047ea61f3152fd66ad6bc690ffcd02c | |
parent | 11233950545b600f3925f4c81768ed6270dc06ca (diff) |
fix: remove render image hook breaking Markdown attrs for images
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | layouts/_default/_markup/render-image.html | 58 |
2 files changed, 2 insertions, 58 deletions
@@ -11,6 +11,8 @@ Tastefejl is a fork of the [Typo] Hugo theme, with the following changes: * Replaced the default footer saying *Powered by Hugo and tomfran/typo* with `<meta name=generator>` tags because nobody cares. +* Removed the render image hook that broke Markdown attributes for images (can be enabled with `markup.goldmark.parser.attribute.block = true`). + * Removed [Simple Icons] because I don't want to plaster brands on my website and at one point a 50MB .html file was committed (I filtered the git history to reduce the size of the repository.) diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html deleted file mode 100644 index a1bc158..0000000 --- a/layouts/_default/_markup/render-image.html +++ /dev/null @@ -1,58 +0,0 @@ -{{/* -To get page resources and relative paths to work. Copied as is from default -hook: -https://github.com/gohugoio/hugo/blob/89bd02/tpl/tplimpl/embedded/templates/_default/_markup/render-image.html -*/}} -{{- $u := urls.Parse .Destination -}} -{{- $url := $u.String -}} -{{- $imgResource := .Page.Scratch.Get "typoNilVariable" -}} -{{- if not $u.IsAbs -}} - {{- $path := strings.TrimPrefix "./" $u.Path -}} - {{/* Check if this is a page bundle or standalone page */}} - {{- if .PageInner.Resources -}} - {{- $imgResource = .PageInner.Resources.Get $path -}} - {{- else if (or .PageInner.Parent .PageInner.Parent.Resources) -}} - {{- $imgResource = .PageInner.Parent.Resources.Get $path -}} - {{- end -}} - {{- $imgResource := or $imgResource (resources.Get $path) -}} - {{- with $imgResource -}} - {{- $url = .RelPermalink -}} - {{- with $u.RawQuery -}} - {{- $url = printf "%s?%s" $url . -}} - {{- end -}} - {{- with $u.Fragment -}} - {{- $url = printf "%s#%s" $url . -}} - {{- end -}} - {{- end -}} -{{- end -}} - -{{/* Split URL at # */}} -{{ $url = $url | safeURL }} -{{ $file_name_array := split $url "#" }} - -{{/* -Iterate over all tags, which are in pos 1 to len array - 1, -and build the img class string as "img-tag1 img-tag2 ..." -*/}} - -{{ $classes := "" }} - -{{ range $idx := seq (sub (len $file_name_array) 1) }} -{{ $tag := index $file_name_array $idx }} -{{ $classes = printf "%s img-%s" $classes $tag}} -{{ end }} - - -{{/* Use the computed classes on the rendered figure */}} -<figure class="{{ $classes }}"> - - <div class="img-container" {{ with $imgResource }}style="--w: {{ .Width }}; --h: {{ .Height }};"{{ end }}> - <img loading="lazy" alt="{{ .Text }}" src="{{ $url }}" {{ with $imgResource }}width="{{ .Width }}" height="{{ .Height }}"{{ end }}> - </div> - - {{ with .Title }} - <div class="caption-container"> - <figcaption> {{ . | markdownify}} </figcaption> - </div> - {{ end }} -</figure> |