0

I'm a bit new to emacs and I'm trying to play with the idea of publishing some notes in org-mode as a blog. I've been reading the manual and writing the publish.el file. I understand I need to set the variable org-publish-project-alist. One of the things I want to do is to remove the css and js included in the export and use my own. There are two option in the manual to disable them :html-head-include-default-style and :html-head-include-scripts; so far so good. The problem is when I want to add my own, the manual says the option :html-head would do the job and indeed, if set it to a string it gives the desired result: It adds that string in the header of the resulting HTML file. Now, the header is far from finished so I thought of defining a variable to contain a longer and more complex string but for some reason with this, the publishing gives me the following error:

Publishing file /home/eduardo/Sites/org_blog/posts/index.org using ‘org-html-publish-to-html’ org-html-template: Wrong type argument: sequencep, org-blog-header

I'm aware I could just add the header to each org file with #+HTML_HEAD or the same using #+SETUPFILE and it could be perfectly functional, however I'd like to have a complete separation between writing and setup.

Edit: How can I use the variable to define the string in the option :html-head? And why is it rejecting it in one form and not in the other?


Here are the two parts on the publish.el file:

The definition of the variable containing the string for the header:

   (defvar org-blog-header
     "<link rel=\"stylesheet\" type=\"text/css\" href=\"index.css\" />
      <link rel=\"icon\" type=\"image/x-icon\" href=\"favicon.ico\">")

The definition of org-publish-project-alist:

   (setq org-publish-project-alist   '(
   
   ("org-posts"
   :base-directory "~/Sites/org_blog/posts/"
   :base-extension "org"
   :publishing-directory "~/Sites/org_blog/public/"
   :recursive t
   :exclude ".*\.draft\.org"
   :with-toc nil
   :with-title nil
   :section-numbers nil

   :auto-sitemap t
   :sitemap-filename "index.org"

   :html-head-include-default-style nil
   :html-head-include-scripts nil
   :html-head org-blog-header

   :publishing-function org-html-publish-to-html
   )
   
   ("org-static"
   :base-directory "~/Sites/org_blog/static/"
   :base-extension "css\\|js"
   :publishing-directory "~/Sites/org_blog/public/"
   :recursive t
   :publishing-function org-publish-attachment
   )
   
   ("org" :components ("org-posts" "org-static")))) 
  • https://emacs.stackexchange.com/tags/elisp/info – Drew Jun 29 '20 at 20:31
  • The question isn't clear. What are you asking? You seem to simply tell us what you're doing. What's the specific problem or question? – Drew Jun 29 '20 at 20:32
  • I edited to add an explicit question. Thanks for the tip. I ask it here also: Why the value is rejected when I use a variable (even if it's defined as a string) and why is accepted when it's defined explicitly as a string? How can I make use of the variable? – egomezcana Jun 29 '20 at 21:39
  • See the linked question and also [this quetion](https://emacs.stackexchange.com/questions/58563/using-variables-on-org-publish-project-alist?noredirect=1) – NickD Jun 29 '20 at 21:45
  • @NickD Thanks! I wasn't aware of this! Now that I know about backquote I feel dumb... – egomezcana Jun 29 '20 at 21:55
  • You may find this setup helpful: https://juanjose.garciaripoll.com/blog/org-mode-html-templates/index.html – Lorem Ipsum Jun 30 '20 at 17:15

0 Answers0