I want to write an static website using org-mode and publish it from emacs. For this, I followed the tutorial I found in org-mode site.

My site directory tree is as follows:


My org-publish-project-alist looks as follows:

(setq org-publish-project-alist
        :base-directory "~/org"
        :base-extension "org"
        :publishing-directory "~/public_html"
        :recursive t
        :publishing-function org-html-publish-to-html
        :headline-levels 4             ; Just the default for this project.
        :auto-preamble t

        :base-directory "~/org"
        :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
        :publishing-directory "~/public_html"
        :recursive t
        :publishing-function org-publish-attachment

        ("org" :components ("org-notes" "org-static"))

I have not been able to link my stylesheet.css in the index.html generated. This is how I tried to set the local variable org-export-html-style at the bottom of index.org

# Local Variables:
# org-export-html-style: "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/stylesheet.css\" />"
# End:

What am I missing?

  • 1
    There is no variable called org-export-html-style any more. Maybe what you want is org-html-head? Or the in-file version in the answer by @jamesmaj?
    – NickD
    Commented Jun 10, 2020 at 3:17
  • 1
    The tutorial is very old and probably contains a bunch of things that don't work any more. You might want to report this question as a bug to the Org mode mailing list.
    – NickD
    Commented Jun 10, 2020 at 3:25
  • 1
    I fixed two instances of obsolete variables in that tutorial, but if you find more, please report them to the mailing list.
    – NickD
    Commented Jun 10, 2020 at 3:37
  • Thank you for fixing the variables! Although it is going to be hard to know what is obsolete without knowing org in depth, which is my case.
    – Navarro
    Commented Jun 10, 2020 at 8:03
  • I understand and sympathize: there is a lot of old stuff that needs fixing on Worg, but the experienced people don't need the tutorials so they don't test them. That leaves the inexperienced ones to fall into all the potholes. All I can say is: complain loudly!
    – NickD
    Commented Jun 10, 2020 at 14:47

1 Answer 1


Try adding this line to the top of the org file:

#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="./css/stylesheet.css" />

Reference: https://orgmode.org/manual/CSS-support.html

  • 1
    Any idea how to make this automatic for all files in the project?
    – ttb
    Commented Mar 20, 2021 at 7:18
  • @ttb: you can put it in a <template>.org file and use #+SETUPFILE: <template>.org in all files Commented May 19, 2021 at 16:05

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.