Hi Christian,

Thanks for pointing that out! It was not super obvious (to me atleast) from Rohit's email but I see your point.

Kind regards,
Ashish

On 4/12/25 19:14, Christian Moe wrote:
But is your local stylesheet uploaded to the server, as it has to be for
the stylesheet link in your HTML head to locate it? That's what Rohit
was getting at, I think.

Apologies if this is obvious and your problem is a different one, but
it's not clear from your reply. You say that a link to a remote
stylesheet already on the web works fine, but a link to a local
stylesheet doesn't. This is the behavior is what you'd expect to see if
the problem is that you haven't configured org-publish to upload CSS
stylesheets.

You need to either upload the stylesheet manually, or configure an
org-publish subproject with

  :base-extension "css"
  :publishing-function org-publish-attachment

to tell org-publish to look for .css files and publish them to the
server just as they are, as in Rohit's example config.


Yours,
Christian



"Ashish Panigrahi" <pub...@ashishpanigrahi.com> writes:

Hi,

Sorry about the late response. Life got in the way.

Org-publish, by default, only processes org files. If you want to include CSS

files, images, and other non-org content, you need to process them as

attachments.
Sure, but I don't see a reason why my original snippet wouldn't work. If I 
replace the local css file with a cdn link instead, for example

(setq org-html-validation-link nil
       org-html-head-include-scripts nil
       org-html-doctype "html5"
       org-html-html5-fancy t
       org-html-html-include-default-style nil
       ;; org-html-head "<link rel=\"stylesheet\" type=\"text/css\" href=\"new.css\" 
/>")
       org-html-head "<link rel=\"stylesheet\"
       href=\"https://cdn.jsdelivr.net/npm/@exampledev/new.css@1.1.2/new.min.css\"; 
/>")

works just fine. It only seems to have a problem when the css file is
local. Any way to mitigate this? I initially thought that perhaps its
an issue with orgmode being unable to find the stylesheet due to some
incorrect path but doesn't seem to be the case.

Kind regards,
Ashish

March 23, 2025 at 6:42 AM, "Rohit Patnaik" <quanti...@quanticle.net> wrote:



Org-publish, by default, only processes org files. If you want to include CSS

files, images, and other non-org content, you need to process them as

attachments.

So, for example, this is what I have:

(setq org-publish-project-alist

  '(("website-orgfiles"

  :base-directory "$HOME/website_src/"

  :publishing-directory "$HOME/website_publish/"

  :recursive t

  :headline-levels 6

  :sections-numbers nil

  :html-head-include-default-style nil

  :html-head

  "<link rel=\"stylesheet\" type=\"text/css\" href=\"/website_style.css\" />)

  ("website-images"

  :base-directory "$HOME/website_src/images/"

  :publishing-directory "$HOME/website_publish/images/"

  :recursive t

  :base-extension "png\\|jpg\\|gif"

  :publishing-function org-publish-attachment)

  ("website-css"

  :base-directory "$HOME/website_src/css/"

  :publishing-directory "$HOME/website_publish/"

  :base-extension "css"

  :publishing-function org-publish-attachment)

  ("website"

  :components ("website-orgfiles"

  "website-images"

  "website-css"))))

In other words, I break up my website project into separate subprojects for CSS,

images, and org-files, and include them as components of the main website

project.

-- Rohit



Reply via email to