I'm in the process of re-writing this blog to move away from hugo and stuff I have no time to go and figure out into just a pure orgmode & emacs publish route. One problem I ran into was inserting links via C-l did not export correctly into the HTML.
My folder structure is
- Top level
- .packages
- assets
- head.html
- html_preamble.html
- images
- vh_001.jpg
-
- content
- posts
- vh.org
-
- .build.sh
- org-website-publish.el
To get them working I wrote a separate insert link function;
;; my link insert (defun my/org-insert-image-link (path) "Insert Org link with ../images/filename.ext instead of full PATH." (interactive "fImage file: ") (let* ((filename (file-name-nondirectory path)) (relpath (concat "../images/" filename))) (insert (format "[[file:%s]]" relpath))))
- and bound it into orgmode function only on key
C-i
;; my link insert (with-eval-after-load 'org (define-key org-mode-map (kbd "C-c i") #'my/org-insert-image-link))
Now in the HTML source my images are coded as <img src="../images/vh_001.JPG" alt="vh_001.JPG"> and when served visible in the webpage 😊