0

I've been following this setup to export my org-roam notes with ox-hugo, but I get the following kind of errors when exporting.

ERROR 2022/01/03 09:27:37 [en] REF_NOT_FOUND: Ref "../../../../../data/Documents/rnotes/org/20211206181129-sdn_vs_nfv.md": "/home/eros/Documents/rnotes/hugo/content/posts/20211206162106-software_defined_networking.md:29:18": page not found

Indeed I can see that in the .md file the link is exported as follows

+++
title = "SDN vs NFV"
draft = false
+++

While both [SDN]({{<relref "../../../../../data/Documents/rnotes/org/20211206162106-software_defined_networking.md#" >}})

While I would expect something similar to this (from here), since all the .md files are actually stored in the same folder.

+++
title = "Arguments Against Bayesian Inference"
author = ["Jethro Kuan"]
draft = false
+++

tags
: [Bayesian Inference]({{<relref "bayesian_inference.md#" >}})

I'm using the same config.toml as this one, except I've set the baseURL to localhost

My publish.el

(require 'package)

(package-initialize)

(setq package-archives '(("melpa" . "https://melpa.org/packages/")
                         ("org" . "http://orgmode.org/elpa/")))

(require 'find-lisp)
(require 'ox-hugo)

(defun roam-publish (file)
  (with-current-buffer (find-file-noselect file)
    (setq org-hugo-base-dir "../hugo")
    (let ((org-id-extra-files (find-lisp-find-files "." "\.org$")))
      (org-hugo-export-wim-to-md))))

And the build.pycalling it

#!/usr/bin/env python

import glob
from pathlib import Path

files = glob.glob("org/*.org")

with open('build.ninja', 'w') as ninja_file:
    ninja_file.write("""
rule org2md
  command = emacs --batch -l publish.el --eval \"(roam-publish \\"$in\\")"
  description = org2md $inxb
""")
    
    for f in files:
        path = Path(f)
        output_file = f"hugo/content/posts/{path.with_suffix('.md').name}"
        ninja_file.write(f"""
build {output_file}: org2md {path}
""")

import subprocess
subprocess.call(["ninja"])
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.