0

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:

~/org
    css/
      stylesheet.css
    index.org

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

(setq org-publish-project-alist
      '(
        ("org-notes"
        :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
        )

        ("org-static"
        :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 Jun 10 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 Jun 10 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 Jun 10 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 Jun 10 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 Jun 10 at 14:47
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

| improve this answer | |

Your Answer

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

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