I am trying to use ox-hugo
package in emacs to build my personal blog however I am encountering problem when trying to export my personal init.el
file to my personal page:
I have managed to discover once I removed the following block from my generated .md file the problem will be gone:
Enabling links within Emacs:
;; Follow Hugo links
(defun org-hugo-follow (link)
"Follow Hugo link shortcodes"
(org-link-open-as-file
(string-trim "{{% ref test.org %}}" "{{% ref " "%}}")))
;; New link type for Org-Hugo internal links
(org-link-set-parameters
"hugo"
:complete (lambda ()
(concat "{{% ref */"
(file-name-nondirectory
(read-file-name "File: "))
" %}}"))
:follow #'org-hugo-follow)
The error message is **“/Users/zhouqiaohui/Blog/content/en/post/emacs-learning/Emacs.md:1:1”: unrecognized character in shortcode action: U+002A ‘*’. Note: Parameters with non-alphanumeric args must be quoted **
If I remove
;; New link type for Org-Hugo internal links
(org-link-set-parameters
"hugo"
:complete (lambda ()
(concat "{{% ref */"
(file-name-nondirectory
(read-file-name "File: "))
" %}}"))
:follow #'org-hugo-follow)
The error message persist but now the shortcode is " "
. Also one perculiarity is the error message said the error is at line 1:1
which doesn’t reflect the true lines where the problem exists. I am wondering why it throws these messages and why?
For your reference, the org source block looks the following:
#+begin_src emacs-lisp
;; Follow Hugo links
(defun org-hugo-follow (link)
"Follow Hugo link shortcodes"
(org-link-open-as-file
(string-trim "{{% ref test.org %}}" "{{% ref " "%}}")))
;; New link type for Org-Hugo internal links
(org-link-set-parameters
"hugo"
:complete (lambda ()
(concat "{{% ref */"
(file-name-nondirectory
(read-file-name "File: "))
" %}}"))
:follow #'org-hugo-follow)
#+end_src