
Blogging with Emacs org-mode - pksadiq
https://www.sadiqpk.org/blog/2018/08/08/blogging-with-org-mode.html
======
Scarblac
I once tried to do this as well, and got sucked into the rabbit hole of
tinkering with little scripts and hacks and trying things out and never
writing my first blog post before I lost motivation.

Next time I feel like I want to write a blog I'll just put it on wordpress.com
or so.

~~~
baby
That’s what I tell everyone. Blogging is about the content, not the form. Do
not waste time doing anything else than writing. Setup a wordpress and write,
once you have more content take a day to transfer stuff to jekyll or
something.

~~~
OskarS
I think the pleasure of doing something like this is in the pure tinkering.
Setting up the system just like you want it is kind-of fun. There's some value
in that.

------
mikekchar
I realised a while ago that Github had an org mode renderer. So I've been
working on a blog post that's hosted directly on Github (without needing to
export to HTML). The renderer has some problems, but it's been OK for my code
examples. Completely unfinished blog post here for example purposes only:
[https://github.com/ygt-
mikekchar/oojs/blob/master/oojs.org](https://github.com/ygt-
mikekchar/oojs/blob/master/oojs.org) You can look at raw mode to see what the
source code looks like.

One of these days, I'm going to see if I can get something similar working on
GitLab (which I've started using and admit to liking better at the moment). I
think it should be easy, if a bit expensive (for them) because I should be
able to set up a docker image with Emacs and export the HTML to generate a
static page.

P.S. Anyone interested in the content of my blog post -- I got stalled trying
to reason about the purpose of "this/self", but I've unstuck myself and should
be finishing it up soon.

------
clircle
I use org-page ([https://github.com/kelvinh/org-
page](https://github.com/kelvinh/org-page)) to write my blog. It has a pretty
cool workflow if you are into git, and integrates well with github pages.

The project seems to be dead (or stable!?), but I keep using it because I made
some small tweaks to the default theme, which resulted in a clean looking
website.

Maybe I'll switch to vanilla org-mode for static website generation in the
future since I seem to always be in the mood to remove dependencies from my
emacs config these days.

------
mc_
Nikola[0] has an orgmode plugin[1] that works fine for my blog. After I write
something up, nikola builds the site (incremental build), I can view it
locally to verify the rendering, and finally rsync the changes up to the web
server.

[0] [https://getnikola.com/](https://getnikola.com/)

[1]
[https://plugins.getnikola.com/v8/orgmode/](https://plugins.getnikola.com/v8/orgmode/)

~~~
julian55
I use Pelican[0] which also has an org-mode plugin[1]. I tend to use markdown
for my blog but I do use org-mode for other organising stuff.

[0] [https://blog.getpelican.com/](https://blog.getpelican.com/)

[1] [https://github.com/getpelican/pelican-
plugins/tree/master/or...](https://github.com/getpelican/pelican-
plugins/tree/master/org_reader)

------
To1ne
So the blog index is maintained by hand?
[https://gitlab.com/sadiq/sadiq.gitlab.io/blob/master/src/blo...](https://gitlab.com/sadiq/sadiq.gitlab.io/blob/master/src/blog/blog.org)

That's a bit of a pickle.

------
andreareina
I prefer keeping everything in one file (but exporting to separate files) so I
hacked something up[1]. It doesn't build the index, but it would be pretty
easy to extend to do so.

There's also Arthur Malabarba's extension[2] to ox-jekyll that's a much more
complete solution.

[1]
[https://gist.github.com/andreareina/37c634f102f819db8e49828f...](https://gist.github.com/andreareina/37c634f102f819db8e49828f34934542)

[2] [http://endlessparentheses.com/how-i-blog-one-year-of-
posts-i...](http://endlessparentheses.com/how-i-blog-one-year-of-posts-in-a-
single-org-file.html)

------
e19293001
You can do python stuffs too. Similar with jupyter:
[https://news.ycombinator.com/item?id=16842786](https://news.ycombinator.com/item?id=16842786)

~~~
flukus
How does jupyter handle embedded data? I've found org mode to be fantastic for
opening "literate debugging" of bugs, and being able to do things like embed
sql to show the relevant data. My only frustration is that the data get's
embedded in the document, I'd prefer it to be a "virtual" element.

~~~
taeric
With org, either typically you are showing the data, or you reference it
elsewhere. You _can_ have a session going that is holding a reference,
however, it is much easier and more practical to send it to table or a file.
(I almost said "local file" but that isn't necessary, either. It mostly does
as you would expect with TRAMP style filenames.)

------
giggles_giggles
>boring content ahead

aw, it's not boring! Don't sell yourself short!

------
dima55
Did the existing org-to-blog things not work for you? Here's a (probably
incomplete) list:

    
    
        https://orgmode.org/worg/org-blog-wiki.html
    

I've been using v1 of o-blog for a while, and it works ok:
[http://notes.secretsauce.net](http://notes.secretsauce.net)

Maybe the other options are better, I don't know. Would definitely be
interested in hearing people's personal experiences.

~~~
kaushalmodi
> Maybe the other options are better, I don't know. Would definitely be
> interested in hearing people's personal experiences.

If you are open to trying out Hugo, see if my above comment[1] regarding ox-
hugo.

[1]:
[https://news.ycombinator.com/item?id=17721272](https://news.ycombinator.com/item?id=17721272)

------
orsenthil
I ran into a problem following the example

``` $ emacs --batch -q -l src/my-web.el -f org-publish-all Cannot open load
file: No such file or directory, htmlize ```

I tried and succeeded in installing htmlize. But still ran into this issue.
How do I resolve this?

~~~
pksadiq
If you are trying to use htmlize, download the file[0] to src directory, such
that htmlize package is available as ~/web/src/htmlize.el

Now run emacs:

    
    
      ~/web$ emacs --batch -q -l src/htmlize.el\
      -l src/my-web.el -f org-publish-all
    

See
[https://gitlab.com/sadiq/sadiq.gitlab.io/blob/master/.gitlab...](https://gitlab.com/sadiq/sadiq.gitlab.io/blob/master/.gitlab-
ci.yml)

You can simply download/clone the complete repo[1] and run the above command
from its root directory.

[0] [https://github.com/hniksic/emacs-
htmlize/blob/master/htmlize...](https://github.com/hniksic/emacs-
htmlize/blob/master/htmlize.el)

[1]
[https://gitlab.com/sadiq/sadiq.gitlab.io](https://gitlab.com/sadiq/sadiq.gitlab.io)

------
peatmoss
> My idea was to put all articles (posts) in a single org file

Unfortunately, this is exactly what I'd like to do. Does anyone have cool
examples of this alternate workflow?

~~~
kaushalmodi
I developed the ox-hugo[1] Emacs package, which allows exporting multiple
posts (even the website structural pages like Home page, About page, etc.)
from a single Org file.

So here's the elevator pitch:

\- ox-hugo is an Emacs package that exports from Org mode to Markdown format
that's compatible with Hugo ([https://gohugo.io](https://gohugo.io)) /
Blackfriday + automagically converts natural* Org metadata to TOML/YAML front-
matter.

\- To understand what I mean by "natural" Org metadata, see this table[2].

\- ox-hugo works with Hugo. I let each tool to do what they are best at:

(i) Org mode deals with the rich markup (Org macros, INCLUDE, TOC, keywords,
Org Babel, NoWeb, property/tag inheritance, etc.) and Emacs/Elisp processing,
and

(ii) Hugo deals with all the "Web stuff" in super-fast fashion (roughly 500
pages in less than a second [depends on your theme efficiency too]):
Markdown->HTML conversion, generation of list pages, taxonomy pages,
RSS/Atom/JF2/.. feeds, minification, cache busting, page generation using
JSON/TOML/.. data, etc.

\- I prefer having most of the posts be exported from a _single_ Org file (my
blog[6] source[3]). So ox-hugo definitely supports that. It also supports the
conventional flow of exporting each Org file to a single post too (I use that
style too, for my "notes" posts).

\- The ox-hugo doc site[1] is dog-fooded by ox-hugo itself. Here's the single
Org file[4] that holds the content for the entire site.

\--> Here are few Real World Examples[5] of people using ox-hugo + Hugo.

== Refs ==

[1]: [https://ox-hugo.scripter.co/](https://ox-hugo.scripter.co/)

[2]: [https://ox-hugo.scripter.co/doc/org-meta-data-to-hugo-
front-...](https://ox-hugo.scripter.co/doc/org-meta-data-to-hugo-front-
matter/#for-subtree-based-exports)

[3]:
[https://gitlab.com/kaushalmodi/kaushalmodi.gitlab.io/blob/ma...](https://gitlab.com/kaushalmodi/kaushalmodi.gitlab.io/blob/master/content-
org/scripter-posts.org)

[4]: [https://raw.githubusercontent.com/kaushalmodi/ox-
hugo/master...](https://raw.githubusercontent.com/kaushalmodi/ox-
hugo/master/doc/ox-hugo-manual.org)

[5]: [https://ox-hugo.scripter.co/doc/examples/](https://ox-
hugo.scripter.co/doc/examples/)

[6]: [https://scripter.co/](https://scripter.co/)

PS: Your user name sounds a bit familiar. So I apologize if I have already
mentioned ox-hugo to you.

~~~
colelyman
I really enjoy using ox-hugo to blog as well, it works very well and does
everything that I need it to do! @kaushalmodi did a great job developing it

------
webkike
I do something similar for my blog. I love orgs embedded code features

