kaushalmodi / ox-hugo

A carefully crafted Org exporter back-end for Hugo
https://ox-hugo.scripter.co
GNU General Public License v3.0
871 stars 132 forks source link

Images not being copied to output directory #339

Closed zzamboni closed 2 years ago

zzamboni commented 4 years ago

Actual Behavior

An image included in a post is linked in the output to its original location, instead of being copied to the output bundle's directory.

Expected Behavior

As per https://ox-hugo.scripter.co/doc/image-links/, I expected the image to be copied to the output bundle directory.

Example Org File

The relevant file is included into my main ox-hugo file via an #+include directive: https://gitlab.com/zzamboni/zzamboni.org/-/blob/6f5ce4cdd59bc45a8bd103e63b64cfbea12e6b79/content-org/zzamboni.org#L343

The included file is here, pointing to the original image links: https://gitlab.com/zzamboni/dot-emacs/-/blob/a12c496751993d16ddadc97060ba35a96d1d5719/init.org#L1564-1572

Generated Markdown File or Error

The rendered output tries to link to the images in their original places instead of copying them under the bundle output directory, as seen here: https://gitlab.com/zzamboni/zzamboni.org/-/blob/6f5ce4cdd59bc45a8bd103e63b64cfbea12e6b79/content/post/my-emacs-configuration-with-commentary/index.md#L1535-1539

Ox-Hugo Debug Information

Debug Info # Debug information for `ox-hugo` ## Emacs Version GNU Emacs 26.3 (build 1, x86_64-apple-darwin19.3.0, NS appkit-1894.30 Version 10.15.3 (Build 19D76)) of 2020-03-11 ## Org Version Org mode version 9.3.6 (release_9.3.6-431-ge81cd9 @ /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/) ## Hugo Version Hugo Static Site Generator v0.67.1/extended darwin/amd64 BuildDate: unknown ### Org `load-path` shadows **Warning**: Possible mixed installation of Org /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-stan hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-stan /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-exp hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-exp /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-J hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-J /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-emacs-lisp hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-emacs-lisp /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-css hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-css /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-lob hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-lob /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-forth hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-forth /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-macs hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-macs /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-version hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-version /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-scheme hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-scheme /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ox hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ox /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-abc hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-abc /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-C hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-C /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-capture hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-capture /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-ref hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-ref /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-clojure hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-clojure /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-mouse hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-mouse /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-ledger hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-ledger /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-ctags hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-ctags /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-entities hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-entities /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-archive hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-archive /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-screen hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-screen /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-haskell hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-haskell /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-asymptote hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-asymptote /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-table hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-table /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ox-org hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ox-org /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-plot hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-plot /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-awk hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-awk /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-groovy hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-groovy /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-octave hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-octave /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-faces hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-faces /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-colview hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-colview /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-R hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-R /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-timer hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-timer /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-ebnf hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-ebnf /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-mobile hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-mobile /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-fortran hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-fortran /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-shell hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-shell /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-perl hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-perl /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-sqlite hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-sqlite /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-sed hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-sed /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-list hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-list /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-ruby hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-ruby /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-eval hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-eval /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-habit hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-habit /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-clock hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-clock /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ox-html hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ox-html /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-src hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-src /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-lisp hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-lisp /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-ditaa hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-ditaa /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-pcomplete hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-pcomplete /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-lint hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-lint /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ox-latex hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ox-latex /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-sass hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-sass /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-io hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-io /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-tangle hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-tangle /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-calc hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-calc /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-java hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-java /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ox-icalendar hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ox-icalendar /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ox-md hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ox-md /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ox-beamer hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ox-beamer /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-element hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-element /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-protocol hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-protocol /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-mscgen hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-mscgen /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-gnuplot hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-gnuplot /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-latex hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-latex /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-id hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-id /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-vala hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-vala /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ox-man hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ox-man /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-feed hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-feed /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-lua hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-lua /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-table hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-table /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-ocaml hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-ocaml /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-coq hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-coq /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-picolisp hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-picolisp /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-indent hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-indent /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-lilypond hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-lilypond /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-matlab hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-matlab /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-datetree hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-datetree /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-python hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-python /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-makefile hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-makefile /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-duration hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-duration /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-agenda hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-agenda /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-dot hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-dot /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-js hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-js /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ox-publish hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ox-publish /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-inlinetask hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-inlinetask /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-org hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-org /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-core hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-core /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-compat hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-compat /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ox-odt hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ox-odt /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-plantuml hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-plantuml /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ox-ascii hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ox-ascii /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-loaddefs hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-loaddefs /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-hledger hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-hledger /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-maxima hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-maxima /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-macro hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-macro /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-sql hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-sql /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-attach hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-attach /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-processing hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-processing /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ox-texinfo hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ox-texinfo /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-crypt hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-crypt /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-footnote hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-footnote /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/org-install hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/org-install /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-comint hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-comint /Users/taazadi1/.emacs.d/lisp/org-mode/lisp/ob-shen hides /usr/local/Cellar/emacs-head/26.3_1/share/emacs/26.3/lisp/org/ob-shen Study the output of `M-x list-load-path-shadows`. ## `ox-hugo` defcustoms
org-hugo-section "posts"
org-hugo-use-code-for-kbd t
org-hugo-preserve-filling t
org-hugo-delete-trailing-ws t
org-hugo-prefer-hyphen-in-tags t
org-hugo-allow-spaces-in-tags t
org-hugo-tag-processing-functions (org-hugo–tag-processing-fn-replace-with-spaces-maybe org-hugo–tag-processing-fn-replace-with-hyphens-maybe)
org-hugo-auto-set-lastmod nil
org-hugo-export-with-toc nil
org-hugo-export-with-section-numbers nil
org-hugo-front-matter-format "toml"
org-hugo-default-static-subdirectory-for-externals "ox-hugo"
org-hugo-external-file-extensions-allowed-for-copying ("jpg" "jpeg" "tiff" "png" "svg" "gif" "mp4" "pdf" "odt" "doc" "ppt" "xls" "docx" "pptx" "xlsx")
org-hugo-date-format "%Y-%m-%dT%T%z"
org-hugo-paired-shortcodes ""
org-hugo-langs-no-descr-in-code-fences nil
org-hugo-suppress-lastmod-period 0.0
org-hugo-front-matter-format "toml"
kaushalmodi commented 4 years ago

Thanks for that info. I'll find some time this week to reproduce the issue and hopefully have a fix.

kaushalmodi commented 4 years ago

Sorry, a month has flown by and I still haven't found time to look into this. I have been looking only at quick bug fixes in the past month.

This is next on my list.

kaushalmodi commented 4 years ago

As per https://ox-hugo.scripter.co/doc/image-links/, I expected the image to be copied to the output bundle directory.

I haven't yet documented the behavior of image copying for page bundles :P

I have the auto-copying of images for page bundles implemented for a while. Here's its test case: https://ox-hugo.scripter.co/test/images-in-content/page-bundle-images-in-same-dir/

Here's the relevant Org source from this test file:

* Page Bundle with images in the same dir
:PROPERTIES:
:EXPORT_FILE_NAME: index
:EXPORT_HUGO_BUNDLE: page-bundle-images-in-same-dir
:END:
** Link to an image in the same dir as this Org file
[[file:gnu.png][file:gnu.png]]
** Link to an image containing this bundle's name in the path
[[file:images/page-bundle-images-in-same-dir/org-copy-2.png][file:images/page-bundle-images-in-same-dir/org-copy-2.png]]
** Link to an image in a subdir in the same dir as this Org file
[[file:images/org-copy-1.png][file:images/org-copy-1.png]]

I'm working on adding this to the documentation now ..

kaushalmodi commented 4 years ago

@zzamboni I have now documented this feature here: https://ox-hugo.scripter.co/doc/images-in-content/#images-and-page-bundles . Let me know if that documentation helps you with your goal in this issue. I can then close this issue if so.

zzamboni commented 4 years ago

Hi @kaushalmodi - thanks for your work on this and the documentation, it really clarifies things.

However, I'm afraid the problem I am having is triggered somehow by the fact that the image is included from an included file (since I am seeing the same issue even without bundles).

I have fixed the links in the original issue description to point to the correct lines in specific commits (my previous links had "moved" as I updated the files), and to summarize:

In my blog's zzamboni.org file, I have a post like this, which includes my Emacs config file:

*** DONE My Emacs Configuration, With Commentary                      :emacs:
CLOSED: [2017-12-17 Sun 20:14]
:PROPERTIES:
:export_hugo_bundle: my-emacs-configuration-with-commentary
:export_file_name: index
:export_hugo_custom_front_matter: :featured_image /images/emacs-logo.svg :toc true :aliases /post/2017-12-17-my-emacs-configuration-with-commentary
:END:

<some other stuff>

#+include: "~/.emacs.d/init.org" :lines "19-"

The included init.org file has some lines which include images, like this (now updated to include the bundle name):

#+DOWNLOADED: screenshot @ 2020-03-17 09:54:28
#+attr_org: :width 500
[[file:images/my-emacs-configuration-with-commentary/2020-03-17_09-54-28_screenshot.png]]

  When the cursor is over or next to one of the symbols, it gets expanded into its text representation to make editing easier. This is enabled by setting =prettify-symbols-unprettify-at-point= to ='right-edge=:

#+DOWNLOADED: screenshot @ 2020-03-17 10:22:49
#+attr_org: :width 500
[[file:images/my-emacs-configuration-with-commentary/2020-03-17_10-22-49_screenshot.png]]

When exported by ox-hugo, the post contains lines like these:

{{< figure src="../../../../.emacs.d/images/my-emacs-configuration-with-commentary/2020-03-17_09-54-28_screenshot.png" >}}

When the cursor is over or next to one of the symbols, it gets expanded into its text representation to make editing easier. This is enabled by setting `prettify-symbols-unprettify-at-point` to `'right-edge`:

{{< figure src="../../../../.emacs.d/images/my-emacs-configuration-with-commentary/2020-03-17_10-22-49_screenshot.png" >}}

As you can see, it's including the image from its original path in my filesystem, instead of copying it into the bundle (or even into the static) image directory.

Thanks again for your help!

kaushalmodi commented 4 years ago

Hmm, this (images in included Org files) certainly is an untested case!

I will first need to add a test case for this and then I can debug and may be fix it.

zzamboni commented 4 years ago

Thanks! Let me know if I can help with the investigation in any way.

kaushalmodi commented 2 years ago

@zzamboni Sorry for leaving this hanging for so long.

I tested out exporting images from included Org file and it works well..

I am wondering if the issue you are seeing is similar to https://github.com/kaushalmodi/ox-hugo/issues/500#issuecomment-1006444248

kaushalmodi commented 2 years ago

I'll close this issue for now as I cannot reproduce the problem. Feel free to comment further here.

zzamboni commented 2 years ago

@kaushalmodi Thanks - unfortunately I've not had a chance to check whether I still see this problem, but as soon as I do I will post an update.