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

ox-hugo yields "Unable to resolve link; aborting: ID_LINK" with ID outside of subtree, and broken-links:mark or :t #447

Closed cpbotha closed 2 years ago

cpbotha commented 3 years ago

Actual Behavior

Put point on "the post subtree" in the minimal org example shown below, then do C-c e H H.

This yields the error "Unable to resolve link; aborting: ID_LINK"

I have no problems exporting the whole file or subtree to markdown or HTML using the non-Hugo options on the export backend selection screen.

Expected Behavior

Export the id-free subtree without issues. Especially export the id-free subtree when I have configured org to export with broken links.

How to Reproduce the Issue

Use the example org file below. With point on "the post subtree", try to export to Hugo.

Example Org File

#+author:
#+hugo_custom_front_matter: :author "Charl P. Botha"
#+hugo_auto_set_lastmod: t
#+HUGO_BASE_DIR: ../../../../web/cpbotha.net/
#+HUGO_SECTION: posts/2021

#+OPTIONS: broken-links:mark

* some heading

[[id:2r3742rl3749023][bogus id link]]

* the post subtree
:PROPERTIES:
:EXPORT_FILE_NAME: index.md
:EXPORT_HUGO_BUNDLE: blat
:EXPORT_HUGO_SLUG: blat
:END:

Generated Markdown File or Error

No markdown file is generated, only the error "Unable to resolve link; aborting: ID_LINK"

Ox-Hugo Debug Information

Debug Info # Debug information for `ox-hugo` ## Emacs Version GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2021-06-05 (commit ce7a78d0a8e033f04978b0c0762378ba13d3fa64) ## Org Version Org mode version 9.4.6 (9.4.6-4-g093c94-elpa @ /home/cpbotha/.emacs.d/elpa/org-20210614/) ## Hugo Version hugo v0.83.1-5AFE0A57+extended linux/amd64 BuildDate=2021-05-02T14:38:05Z VendorInfo=gohugoio ### Org `load-path` shadows **Warning**: Possible mixed installation of Org ~/build/mu/mu4e/mu4e-org hides /usr/local/share/emacs/site-lisp/mu4e/mu4e-org ~/build/mu/mu4e/org-mu4e hides /usr/local/share/emacs/site-lisp/mu4e/org-mu4e /home/cpbotha/.emacs.d/elpa/org-20210614/org-install hides /usr/local/share/emacs/28.0.50/lisp/org/org-install /home/cpbotha/.emacs.d/elpa/org-20210614/ob-lob hides /usr/local/share/emacs/28.0.50/lisp/org/ob-lob /home/cpbotha/.emacs.d/elpa/org-20210614/org-tempo hides /usr/local/share/emacs/28.0.50/lisp/org/org-tempo /home/cpbotha/.emacs.d/elpa/org-20210614/ob-ref hides /usr/local/share/emacs/28.0.50/lisp/org/ob-ref /home/cpbotha/.emacs.d/elpa/org-20210614/org-agenda hides /usr/local/share/emacs/28.0.50/lisp/org/org-agenda /home/cpbotha/.emacs.d/elpa/org-20210614/ob-exp hides /usr/local/share/emacs/28.0.50/lisp/org/ob-exp /home/cpbotha/.emacs.d/elpa/org-20210614/ob-lua hides /usr/local/share/emacs/28.0.50/lisp/org/ob-lua /home/cpbotha/.emacs.d/elpa/org-20210614/org-pcomplete hides /usr/local/share/emacs/28.0.50/lisp/org/org-pcomplete /home/cpbotha/.emacs.d/elpa/org-20210614/org-ctags hides /usr/local/share/emacs/28.0.50/lisp/org/org-ctags /home/cpbotha/.emacs.d/elpa/org-20210614/ob-ruby hides /usr/local/share/emacs/28.0.50/lisp/org/ob-ruby /home/cpbotha/.emacs.d/elpa/org-20210614/ol-bbdb hides /usr/local/share/emacs/28.0.50/lisp/org/ol-bbdb /home/cpbotha/.emacs.d/elpa/org-20210614/org-inlinetask hides /usr/local/share/emacs/28.0.50/lisp/org/org-inlinetask /home/cpbotha/.emacs.d/elpa/org-20210614/ob-coq hides /usr/local/share/emacs/28.0.50/lisp/org/ob-coq /home/cpbotha/.emacs.d/elpa/org-20210614/ob-comint hides /usr/local/share/emacs/28.0.50/lisp/org/ob-comint /home/cpbotha/.emacs.d/elpa/org-20210614/ob-picolisp hides /usr/local/share/emacs/28.0.50/lisp/org/ob-picolisp /home/cpbotha/.emacs.d/elpa/org-20210614/org-timer hides /usr/local/share/emacs/28.0.50/lisp/org/org-timer /home/cpbotha/.emacs.d/elpa/org-20210614/org-src hides /usr/local/share/emacs/28.0.50/lisp/org/org-src /home/cpbotha/.emacs.d/elpa/org-20210614/org-datetree hides /usr/local/share/emacs/28.0.50/lisp/org/org-datetree /home/cpbotha/.emacs.d/elpa/org-20210614/ob-lilypond hides /usr/local/share/emacs/28.0.50/lisp/org/ob-lilypond /home/cpbotha/.emacs.d/elpa/org-20210614/ob-maxima hides /usr/local/share/emacs/28.0.50/lisp/org/ob-maxima /home/cpbotha/.emacs.d/elpa/org-20210614/org-keys hides /usr/local/share/emacs/28.0.50/lisp/org/org-keys /home/cpbotha/.emacs.d/elpa/org-20210614/ox hides /usr/local/share/emacs/28.0.50/lisp/org/ox /home/cpbotha/.emacs.d/elpa/org-20210614/ox-man hides /usr/local/share/emacs/28.0.50/lisp/org/ox-man /home/cpbotha/.emacs.d/elpa/org-20210614/org hides /usr/local/share/emacs/28.0.50/lisp/org/org /home/cpbotha/.emacs.d/elpa/org-20210614/org-macro hides /usr/local/share/emacs/28.0.50/lisp/org/org-macro /home/cpbotha/.emacs.d/elpa/org-20210614/org-attach-git hides /usr/local/share/emacs/28.0.50/lisp/org/org-attach-git /home/cpbotha/.emacs.d/elpa/org-20210614/org-mobile hides /usr/local/share/emacs/28.0.50/lisp/org/org-mobile /home/cpbotha/.emacs.d/elpa/org-20210614/org-footnote hides /usr/local/share/emacs/28.0.50/lisp/org/org-footnote /home/cpbotha/.emacs.d/elpa/org-20210614/ob-sql hides /usr/local/share/emacs/28.0.50/lisp/org/ob-sql /home/cpbotha/.emacs.d/elpa/org-20210614/ox-texinfo hides /usr/local/share/emacs/28.0.50/lisp/org/ox-texinfo /home/cpbotha/.emacs.d/elpa/org-20210614/ol-mhe hides /usr/local/share/emacs/28.0.50/lisp/org/ol-mhe /home/cpbotha/.emacs.d/elpa/org-20210614/org-habit hides /usr/local/share/emacs/28.0.50/lisp/org/org-habit /home/cpbotha/.emacs.d/elpa/org-20210614/ox-org hides /usr/local/share/emacs/28.0.50/lisp/org/ox-org /home/cpbotha/.emacs.d/elpa/org-20210614/ol-w3m hides /usr/local/share/emacs/28.0.50/lisp/org/ol-w3m /home/cpbotha/.emacs.d/elpa/org-20210614/org-feed hides /usr/local/share/emacs/28.0.50/lisp/org/org-feed /home/cpbotha/.emacs.d/elpa/org-20210614/ol-docview hides /usr/local/share/emacs/28.0.50/lisp/org/ol-docview /home/cpbotha/.emacs.d/elpa/org-20210614/ox-publish hides /usr/local/share/emacs/28.0.50/lisp/org/ox-publish /home/cpbotha/.emacs.d/elpa/org-20210614/ob-ocaml hides /usr/local/share/emacs/28.0.50/lisp/org/ob-ocaml /home/cpbotha/.emacs.d/elpa/org-20210614/ob-python hides /usr/local/share/emacs/28.0.50/lisp/org/ob-python /home/cpbotha/.emacs.d/elpa/org-20210614/org-refile hides /usr/local/share/emacs/28.0.50/lisp/org/org-refile /home/cpbotha/.emacs.d/elpa/org-20210614/ob-fortran hides /usr/local/share/emacs/28.0.50/lisp/org/ob-fortran /home/cpbotha/.emacs.d/elpa/org-20210614/ob-lisp hides /usr/local/share/emacs/28.0.50/lisp/org/ob-lisp /home/cpbotha/.emacs.d/elpa/org-20210614/ol-eww hides /usr/local/share/emacs/28.0.50/lisp/org/ol-eww /home/cpbotha/.emacs.d/elpa/org-20210614/ol-bibtex hides /usr/local/share/emacs/28.0.50/lisp/org/ol-bibtex /home/cpbotha/.emacs.d/elpa/org-20210614/ox-html hides /usr/local/share/emacs/28.0.50/lisp/org/ox-html /home/cpbotha/.emacs.d/elpa/org-20210614/ob-processing hides /usr/local/share/emacs/28.0.50/lisp/org/ob-processing /home/cpbotha/.emacs.d/elpa/org-20210614/ob-octave hides /usr/local/share/emacs/28.0.50/lisp/org/ob-octave /home/cpbotha/.emacs.d/elpa/org-20210614/org-lint hides /usr/local/share/emacs/28.0.50/lisp/org/org-lint /home/cpbotha/.emacs.d/elpa/org-20210614/ob-plantuml hides /usr/local/share/emacs/28.0.50/lisp/org/ob-plantuml /home/cpbotha/.emacs.d/elpa/org-20210614/org-indent hides /usr/local/share/emacs/28.0.50/lisp/org/org-indent /home/cpbotha/.emacs.d/elpa/org-20210614/ox-md hides /usr/local/share/emacs/28.0.50/lisp/org/ox-md /home/cpbotha/.emacs.d/elpa/org-20210614/ob-latex hides /usr/local/share/emacs/28.0.50/lisp/org/ob-latex /home/cpbotha/.emacs.d/elpa/org-20210614/org-num hides /usr/local/share/emacs/28.0.50/lisp/org/org-num /home/cpbotha/.emacs.d/elpa/org-20210614/ob-J hides /usr/local/share/emacs/28.0.50/lisp/org/ob-J /home/cpbotha/.emacs.d/elpa/org-20210614/ob-sqlite hides /usr/local/share/emacs/28.0.50/lisp/org/ob-sqlite /home/cpbotha/.emacs.d/elpa/org-20210614/ob-clojure hides /usr/local/share/emacs/28.0.50/lisp/org/ob-clojure /home/cpbotha/.emacs.d/elpa/org-20210614/org-attach hides /usr/local/share/emacs/28.0.50/lisp/org/org-attach /home/cpbotha/.emacs.d/elpa/org-20210614/ob-sass hides /usr/local/share/emacs/28.0.50/lisp/org/ob-sass /home/cpbotha/.emacs.d/elpa/org-20210614/ob-scheme hides /usr/local/share/emacs/28.0.50/lisp/org/ob-scheme /home/cpbotha/.emacs.d/elpa/org-20210614/ob-stan hides /usr/local/share/emacs/28.0.50/lisp/org/ob-stan /home/cpbotha/.emacs.d/elpa/org-20210614/org-capture hides /usr/local/share/emacs/28.0.50/lisp/org/org-capture /home/cpbotha/.emacs.d/elpa/org-20210614/ob-table hides /usr/local/share/emacs/28.0.50/lisp/org/ob-table /home/cpbotha/.emacs.d/elpa/org-20210614/org-archive hides /usr/local/share/emacs/28.0.50/lisp/org/org-archive /home/cpbotha/.emacs.d/elpa/org-20210614/ox-ascii hides /usr/local/share/emacs/28.0.50/lisp/org/ox-ascii /home/cpbotha/.emacs.d/elpa/org-20210614/ob-hledger hides /usr/local/share/emacs/28.0.50/lisp/org/ob-hledger /home/cpbotha/.emacs.d/elpa/org-20210614/ol-rmail hides /usr/local/share/emacs/28.0.50/lisp/org/ol-rmail /home/cpbotha/.emacs.d/elpa/org-20210614/org-version hides /usr/local/share/emacs/28.0.50/lisp/org/org-version /home/cpbotha/.emacs.d/elpa/org-20210614/org-entities hides /usr/local/share/emacs/28.0.50/lisp/org/org-entities /home/cpbotha/.emacs.d/elpa/org-20210614/ob-js hides /usr/local/share/emacs/28.0.50/lisp/org/ob-js /home/cpbotha/.emacs.d/elpa/org-20210614/ob-shell hides /usr/local/share/emacs/28.0.50/lisp/org/ob-shell /home/cpbotha/.emacs.d/elpa/org-20210614/org-clock hides /usr/local/share/emacs/28.0.50/lisp/org/org-clock /home/cpbotha/.emacs.d/elpa/org-20210614/ol-gnus hides /usr/local/share/emacs/28.0.50/lisp/org/ol-gnus /home/cpbotha/.emacs.d/elpa/org-20210614/org-list hides /usr/local/share/emacs/28.0.50/lisp/org/org-list /home/cpbotha/.emacs.d/elpa/org-20210614/ob-vala hides /usr/local/share/emacs/28.0.50/lisp/org/ob-vala /home/cpbotha/.emacs.d/elpa/org-20210614/ob-sed hides /usr/local/share/emacs/28.0.50/lisp/org/ob-sed /home/cpbotha/.emacs.d/elpa/org-20210614/org-goto hides /usr/local/share/emacs/28.0.50/lisp/org/org-goto /home/cpbotha/.emacs.d/elpa/org-20210614/org-duration hides /usr/local/share/emacs/28.0.50/lisp/org/org-duration /home/cpbotha/.emacs.d/elpa/org-20210614/ob-eshell hides /usr/local/share/emacs/28.0.50/lisp/org/ob-eshell /home/cpbotha/.emacs.d/elpa/org-20210614/ob-haskell hides /usr/local/share/emacs/28.0.50/lisp/org/ob-haskell /home/cpbotha/.emacs.d/elpa/org-20210614/org-protocol hides /usr/local/share/emacs/28.0.50/lisp/org/org-protocol /home/cpbotha/.emacs.d/elpa/org-20210614/ob-abc hides /usr/local/share/emacs/28.0.50/lisp/org/ob-abc /home/cpbotha/.emacs.d/elpa/org-20210614/ob-emacs-lisp hides /usr/local/share/emacs/28.0.50/lisp/org/ob-emacs-lisp /home/cpbotha/.emacs.d/elpa/org-20210614/ob hides /usr/local/share/emacs/28.0.50/lisp/org/ob /home/cpbotha/.emacs.d/elpa/org-20210614/ob-css hides /usr/local/share/emacs/28.0.50/lisp/org/ob-css /home/cpbotha/.emacs.d/elpa/org-20210614/org-table hides /usr/local/share/emacs/28.0.50/lisp/org/org-table /home/cpbotha/.emacs.d/elpa/org-20210614/ox-latex hides /usr/local/share/emacs/28.0.50/lisp/org/ox-latex /home/cpbotha/.emacs.d/elpa/org-20210614/org-plot hides /usr/local/share/emacs/28.0.50/lisp/org/org-plot /home/cpbotha/.emacs.d/elpa/org-20210614/ox-odt hides /usr/local/share/emacs/28.0.50/lisp/org/ox-odt /home/cpbotha/.emacs.d/elpa/org-20210614/ol hides /usr/local/share/emacs/28.0.50/lisp/org/ol /home/cpbotha/.emacs.d/elpa/org-20210614/ob-shen hides /usr/local/share/emacs/28.0.50/lisp/org/ob-shen /home/cpbotha/.emacs.d/elpa/org-20210614/ob-core hides /usr/local/share/emacs/28.0.50/lisp/org/ob-core /home/cpbotha/.emacs.d/elpa/org-20210614/ob-matlab hides /usr/local/share/emacs/28.0.50/lisp/org/ob-matlab /home/cpbotha/.emacs.d/elpa/org-20210614/ox-beamer hides /usr/local/share/emacs/28.0.50/lisp/org/ox-beamer /home/cpbotha/.emacs.d/elpa/org-20210614/org-colview hides /usr/local/share/emacs/28.0.50/lisp/org/org-colview /home/cpbotha/.emacs.d/elpa/org-20210614/org-faces hides /usr/local/share/emacs/28.0.50/lisp/org/org-faces /home/cpbotha/.emacs.d/elpa/org-20210614/org-mouse hides /usr/local/share/emacs/28.0.50/lisp/org/org-mouse /home/cpbotha/.emacs.d/elpa/org-20210614/ob-R hides /usr/local/share/emacs/28.0.50/lisp/org/ob-R /home/cpbotha/.emacs.d/elpa/org-20210614/ob-ebnf hides /usr/local/share/emacs/28.0.50/lisp/org/ob-ebnf /home/cpbotha/.emacs.d/elpa/org-20210614/ob-awk hides /usr/local/share/emacs/28.0.50/lisp/org/ob-awk /home/cpbotha/.emacs.d/elpa/org-20210614/org-compat hides /usr/local/share/emacs/28.0.50/lisp/org/org-compat /home/cpbotha/.emacs.d/elpa/org-20210614/ol-eshell hides /usr/local/share/emacs/28.0.50/lisp/org/ol-eshell /home/cpbotha/.emacs.d/elpa/org-20210614/ob-mscgen hides /usr/local/share/emacs/28.0.50/lisp/org/ob-mscgen /home/cpbotha/.emacs.d/elpa/org-20210614/ob-dot hides /usr/local/share/emacs/28.0.50/lisp/org/ob-dot /home/cpbotha/.emacs.d/elpa/org-20210614/ol-info hides /usr/local/share/emacs/28.0.50/lisp/org/ol-info /home/cpbotha/.emacs.d/elpa/org-20210614/ob-forth hides /usr/local/share/emacs/28.0.50/lisp/org/ob-forth /home/cpbotha/.emacs.d/elpa/org-20210614/ob-groovy hides /usr/local/share/emacs/28.0.50/lisp/org/ob-groovy /home/cpbotha/.emacs.d/elpa/org-20210614/ob-calc hides /usr/local/share/emacs/28.0.50/lisp/org/ob-calc /home/cpbotha/.emacs.d/elpa/org-20210614/org-macs hides /usr/local/share/emacs/28.0.50/lisp/org/org-macs /home/cpbotha/.emacs.d/elpa/org-20210614/ob-asymptote hides /usr/local/share/emacs/28.0.50/lisp/org/ob-asymptote /home/cpbotha/.emacs.d/elpa/org-20210614/ol-irc hides /usr/local/share/emacs/28.0.50/lisp/org/ol-irc /home/cpbotha/.emacs.d/elpa/org-20210614/ox-icalendar hides /usr/local/share/emacs/28.0.50/lisp/org/ox-icalendar /home/cpbotha/.emacs.d/elpa/org-20210614/org-element hides /usr/local/share/emacs/28.0.50/lisp/org/org-element /home/cpbotha/.emacs.d/elpa/org-20210614/ob-perl hides /usr/local/share/emacs/28.0.50/lisp/org/ob-perl /home/cpbotha/.emacs.d/elpa/org-20210614/ob-makefile hides /usr/local/share/emacs/28.0.50/lisp/org/ob-makefile /home/cpbotha/.emacs.d/elpa/org-20210614/ob-screen hides /usr/local/share/emacs/28.0.50/lisp/org/ob-screen /home/cpbotha/.emacs.d/elpa/org-20210614/org-id hides /usr/local/share/emacs/28.0.50/lisp/org/org-id /home/cpbotha/.emacs.d/elpa/org-20210614/ob-eval hides /usr/local/share/emacs/28.0.50/lisp/org/ob-eval /home/cpbotha/.emacs.d/elpa/org-20210614/ob-java hides /usr/local/share/emacs/28.0.50/lisp/org/ob-java /home/cpbotha/.emacs.d/elpa/org-20210614/ob-tangle hides /usr/local/share/emacs/28.0.50/lisp/org/ob-tangle /home/cpbotha/.emacs.d/elpa/org-20210614/ob-C hides /usr/local/share/emacs/28.0.50/lisp/org/ob-C /home/cpbotha/.emacs.d/elpa/org-20210614/org-crypt hides /usr/local/share/emacs/28.0.50/lisp/org/org-crypt /home/cpbotha/.emacs.d/elpa/org-20210614/ob-org hides /usr/local/share/emacs/28.0.50/lisp/org/ob-org /home/cpbotha/.emacs.d/elpa/org-20210614/ob-gnuplot hides /usr/local/share/emacs/28.0.50/lisp/org/ob-gnuplot /home/cpbotha/.emacs.d/elpa/org-20210614/ob-ditaa hides /usr/local/share/emacs/28.0.50/lisp/org/ob-ditaa /home/cpbotha/.emacs.d/elpa/org-20210614/ob-ledger hides /usr/local/share/emacs/28.0.50/lisp/org/ob-ledger /home/cpbotha/.emacs.d/elpa/org-20210614/org-loaddefs hides /usr/local/share/emacs/28.0.50/lisp/org/org-loaddefs /home/cpbotha/.emacs.d/elpa/org-20210614/ob-io hides /usr/local/share/emacs/28.0.50/lisp/org/ob-io Study the output of `M-x list-load-path-shadows`. ## `ox-hugo` defcustoms
org-hugo-section "posts"
org-hugo-use-code-for-kbd nil
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" "js" "json" "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"
cpbotha commented 3 years ago

Hmmm, digging into the ox-hugo.el code, org-hugo--get-pre-processed-buffer is directly calling org-export-resolve-id-link on id-links outside of the subtree being exported, without the same handling as org-export-data for different types of broken link handling there:

      ((broken-link-handler
        (&rest body)
        `(condition-case err
         (progn ,@body)
           (org-link-broken
        (pcase (plist-get info :with-broken-links)
          (`nil (user-error "Unable to resolve link: %S" (nth 1 err)))
          (`mark (org-export-data
              (format "[BROKEN LINK: %s]" (nth 1 err)) info))
          (_ nil))))))
  1. I would imagine there are good reasons to process links in the whole buffer, else it would not be the case. 2. I'm not seeing a clean way to get the same broken link handling into ox-hugo as in org proper.

Any tips, advice or work-arounds would be greatly appreciated.

(BTW, the id: links outside of the subtree in question all work, they are org-roam links)

cpbotha commented 3 years ago

Because I need to get this post out, I'm hackily and temporarily working around the issue by changing the link condition in org-hugo--get-pre-processed-buffer to:

(when (member type '("custom-id" "id-NOT" "fuzzy")
kaushalmodi commented 3 years ago

Hello,

I just got a chance to read this issue.

I would imagine there are good reasons to process links in the whole buffer

Yes, that was added so that cross-post linking works.

digging into the ox-hugo.el code, org-hugo--get-pre-processed-buffer is directly calling org-export-resolve-id-link on id-links outside of the subtree being exported, without the same handling as org-export-data for different types of broken link handling there:

That's a good point. Can you provide a PR to add support for that?

(BTW, the id: links outside of the subtree in question all work, they are org-roam links)

I haven't yet started using org-roam. Do you mean that you need to add links that work with org-roam but don't work with Org export. e.g. Can you jump to those org-roam links from the Org buffer without org-roam installed?

ChloeZhou1997 commented 2 years ago

I am having the same problem. It seems hugo ox cannot convert the [[id:XXXXX][]] types of link to markdown style directly... I need both internal link and also URL to other org roam styled link . Thank you very much for any suggests

kaushalmodi commented 2 years ago

@cpbotha Does this help? https://github.com/kaushalmodi/ox-hugo/issues/483#issuecomment-1003301339

bphenriques commented 2 years ago

I fixed it by setting org-id-extra-files:

(setq org-id-extra-files (directory-files-recursively "path/to/your/org-roam/directory/" "org"))

See my hugo-site's self-contained init.el reproducing the fix - link. I did the same on my dotfiles.

cpbotha commented 2 years ago

@cpbotha Does this help? #483 (comment)

Indeed it does, thank you very much @kaushalmodi and @patrolli -- I first tried @patrolli's fix (setq org-id-extra-files (find-lisp-find-files org-roam-directory "\.org$")) which worked but was subjectively slower on my org directory than directory-files-recursively.

Later I measured the difference on my setup (Emacs master 2022-01-01 with nativecomp, 870 org files nested in my org-roam-directory, 3 year old i7 laptop with PCIe 3.0 SSD) with directory-files-recursively being more than 10x faster.

(require 'benchmark)
;; 1.6s
(benchmark-elapse (setq org-id-extra-files (find-lisp-find-files org-roam-directory "\.org$")))
;; 0.12s
(benchmark-elapse (setq org-id-extra-files (directory-files-recursively org-roam-directory "\.org$")))

@bphenriques you might want to revise your invocation to use a slightly more accurate regexp that also includes the . and the end of line $ -- else it could catch files like why-org-is-better-than-md.txt ;)

Like this:

(setq org-id-extra-files (directory-files-recursively org-roam-directory "\.org$"))

I'm closing this issue. Although my report was a more specific issue, I was trying to work-around the behaviour that ox-hugo was routinely unable to export due to IDs outside of the post, and this org-id-extra-files fixes that original problem.

bphenriques commented 2 years ago

Thank you, will do!

bphenriques commented 2 years ago

Is anyone encountering this issue during the auto-export hook?

Error (after-save-hook): Error running hook "org-hugo-export-wim-to-md-after-save" because: (user-error Unable to resolve link: "2fa03d4f-948e-4a6e-a38b-178456b578e1") Disable showing Disable logging

If not, it may be my setup as my cicd's emacs installation works fine when calling (org-hugo-export-wim-to-md :all-subtrees nil nil nil)

buhtz commented 2 years ago

Sorry for warming this up. But I did not understand your solution. How did you solved that problem? My error is Unable to resolve link; aborting: "roam:git. org-export-with-broken-link is t (double checked via C-h v). The full debug output can be found in that ox-hugo-dicsussion.

I will also open a thread on org-roam mailing list for that.

kaushalmodi commented 2 years ago

@cpbotha Thanks for digging into the debug in https://github.com/kaushalmodi/ox-hugo/issues/447#issuecomment-862397524. I think that eventually needs to be fixed now. While this issue was for id: type links and that got fixed after ox-hugo started handling those links, the same issue has resurfaced for roam: type links.

@Codeberg-AsGithubAlternative-buhtz I am now tracking that issue in https://github.com/kaushalmodi/ox-hugo/issues/587.