Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,10 @@ enable = false
[[module.mounts]]
source = "content/en"
target = "assets/contentimg"
# Make root-relative static images available to the Markdown render hook.
[[module.mounts]]
source = "static"
target = "assets/staticimg"
[[module.mounts]]
source = "static"
target = "static"
Expand Down
7 changes: 5 additions & 2 deletions layouts/_default/_markup/render-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<!-- PNG and JPEG sources are encoded to WebP at build time and offered through
<picture>. The original stays as the <img> fallback, so nothing in content has
to change and browsers without WebP support still get a working image.
Content is mounted at assets/contentimg (see hugo.toml) because Hugo can only
process files that are resources. -->
Content and static files are mounted under assets (see hugo.toml) because
Hugo can only process files that are resources. -->
<!-- Onclick opens the modal, and displays/overlays the clicked image. -->
<!-- attribution appreciated. github: zjeaton web: https://froglegs.co -->

Expand All @@ -26,6 +26,9 @@
{{- end -}}
{{- $img = resources.Get (path.Join "contentimg" $rel) -}}
{{- if not $img -}}{{- $img = resources.Get $rel -}}{{- end -}}
{{- if and (not $img) (hasPrefix $dest "/") -}}
{{- $img = resources.Get (path.Join "staticimg" $rel) -}}
{{- end -}}
{{- end -}}

<div class="md__image">
Expand Down
Loading