I'm starting to write blogs with org-mode and org-static-blog, but now I'm stuck with a problem respecting exporting graphviz dot file to image file.

So I have a code block like this with (setq org-static-blog-publish-directory "/path/to/blog-site-root/") :

#+BEGIN_SRC dot :file /path/to/blog-site-root/images/2018-12-10-vtable.png :exports results
digraph vtable_example {
    // ...

I want to generate the png while including the image with a relative path ./images/2018-12-10-vtable.png, M-x org-static-blog-publish generates it but gives me html including the absolute local path, which will be 404 at my blog site.

If I set the header arguments of :exports to none, then even the image file will not be generated.

So how can I let org export/babel generate the file and then include it with another path?

1 Answer 1


One appropriate place to do such transformations is the collection of export filters.

You could add org-export-filter-link-functions as a file local or directory local variable to set the url export filter for html export. The following file variable setting replaces the string /path/to/blog-site-root in img urls with .:

# Local Variables:
# org-export-filter-link-functions: ((lambda (data backend info) (when (string-match "<img src=\"file://\\(/path/to/blog-site-root\\)" data) (replace-match "." nil nil data 1)))))
# End:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.