emacs-love / weblorg

Static Site Generator for Emacs
https://emacs.love/weblorg
GNU General Public License v3.0
280 stars 21 forks source link

Per-Page CSS Option — maybe with #+HTML_HEADER? #44

Closed jakebox closed 3 years ago

jakebox commented 3 years ago

I feature I would like is to be able to use a specific CSS file on a single weblorg post. Is there a way to do this? Normally I'd just do, for example, #+HTML_HEAD: <link rel="stylesheet" href="https://latex.now.sh/style.css"> but this won't do it if I generate the pages for weblorg. Is this a feature I am missing? If not I think it would be something nice to add.

Thanks for all the hard work on weblorg, very exciting when I got it up and running, it's a fantastic system.

guilhermecomum commented 3 years ago

Hey @jakebox thanks for your interesting on weblorg, to use a specific css file on single weblorg post, you can use HTML_HEAD propertie as you wrote, but you will need make a small change um post template. If you use the default theme you can add this snippet on post.html

{% block head %}
{{post.html_head | safe}}
{% endblock %}

if you using you own theme just make sure you have a block inside <head> o base template. I hope this works for you!

jakebox commented 3 years ago

@guilhermecomum Thanks for the reply, this worked fairly well! For some reason the page is rendering a bit strangely but I think that is due to my CSS file. I also get an error, Wrong type argument: char-or-string-p, nil, when running publish.el but it doesn't seem to affect anything (that I can see).

Another idea for the future, maybe the generator could pull multiple #+HTML_HEAD: lines from SETUPFILEs, as that seems to be a common practice (putting multiple html heads into a single setupfile, that is). Just an idea.

Thanks very much for the help. Weblorg is a very promising project, great work.