emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Chunyang Xu <mail@xuchunyang.me>
To: Matt Price <moptop99@gmail.com>, Org Mode <emacs-orgmode@gnu.org>
Subject: Re: org to static site?
Date: Thu, 01 Jun 2017 01:05:04 +0800	[thread overview]
Message-ID: <m2o9u9ot33.fsf@xuchunyang.me> (raw)
In-Reply-To: <CAN_Dec_HkRFycfcm6ZWAgd-=Z1kv-nn20UNXUhcLgOoHCWqqNQ@mail.gmail.com>

Matt Price <moptop99@gmail.com> writes:

> I'm trying to wean myself off of Wordpress for next year's teaching
> websites, and am wondering what solutions other people are using for
> turning a collection of org pages and/or subtrees into a static html site.
> I am leaning towards Hugo but honestly not for any sensible reason; I've
> seen other people use Jekyll, though the fact that Github doesn't support
> direct conversion from org-mode removes some of Jekyll's appeal; and I know
> there are a number of other solutions too.
>
> So, I would love to hear what you all recommend.

It is said that Nanoc is flexible. You can convert org mode to HTML with
Pandoc or Emacs. Nanoc supports Pandoc out of box. To use Emacs, you
need to write your own "filter" (Nanoc's terminology, i.e., convert one
format into another), for example,

#+BEGIN_SRC ruby
require 'tempfile'

class OrgFilter < Nanoc::Filter
  identifier :org

  def run(content, params = {})
    file = Tempfile.new(['nanoc', '.org'])
    file.write(content)
    file.close
    system("emacs --batch --load init.el #{file.path} --eval '(org-html-export-to-html nil nil nil t)'")
    html = "#{File.dirname(file.path)}/#{File.basename(file.path, '.org')}.html"
    file.unlink
    File.read(html)
  end
end
#+END_SRC

I just created my own site <https://xuchunyang.me/> with it last
week. The syntax highlighting on code block is provided by htmlize.el.
I noticed `org-html-export-to-html' produces different HTML every time
even the org file is unchanged at all. It is very annoying to me. I
found a work-around to avoid it,

#+BEGIN_SRC emacs-lisp
;; -*- lexical-binding: t; -*-
(let ((id 0))
  (defun org-export-new-reference--use-persistent-id (references)
    (let ((new id))
      (while (rassq new references)
        (setq new (incf id)))
      new)))

(advice-add 'org-export-new-reference
            :override #'org-export-new-reference--use-persistent-id)
#+END_SRC

[...]

--
Org mode version 9.0.7 (release_9.0.7-496-g3d3e24 @
/Users/xcy/src/org-mode/lisp/)

  parent reply	other threads:[~2017-05-31 17:05 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-31 15:00 org to static site? Matt Price
2017-05-31 15:08 ` Russell Adams
2017-05-31 15:17   ` Jeffrey Brent McBeth
2017-05-31 15:29     ` Russell Adams
2017-05-31 15:34       ` John Hendy
2017-05-31 16:20         ` Russell Adams
2017-05-31 16:37           ` John Kitchin
2017-05-31 15:32     ` John Hendy
2017-05-31 16:08       ` Puneeth Chaganti
2017-05-31 16:17         ` John Hendy
2017-05-31 17:05 ` Chunyang Xu [this message]
2017-05-31 19:51   ` John Ankarström
2017-05-31 18:23 ` lists
2017-06-01  7:46 ` Julian M. Burgos
2017-06-01 10:09 ` Rasmus
2017-06-04 18:26 ` Scott Randby
2017-06-05  5:59   ` John Ankarström
2017-06-05 16:54     ` Scott Randby
2017-06-05 21:16       ` Nick Dokos
2017-06-06  2:41         ` Scott Randby
2017-06-10  9:21           ` Nicolas Goaziou
2017-06-10 18:13             ` Scott Randby
2017-06-06  9:12   ` Fabrice Popineau
2017-06-08  8:14     ` Ken Mankoff
2017-11-30  5:13 ` George myglc2 Clemmer
2017-12-01 17:17   ` Tory S. Anderson
2017-12-01 21:13     ` George myglc2 Clemmer
2017-12-01 20:19   ` Adonay Felipe Nogueira
2017-12-02  2:53     ` myglc2
2017-12-05 12:30       ` Rasmus
2017-12-05 16:40         ` myglc2
2017-12-05 19:10         ` ox-publish export subtree scopes? (Was: org to static site?) Kaushal Modi
2017-12-10  7:15           ` ox-publish export subtree scopes? Narendra Joshi
2017-12-19 11:53             ` Rasmus
2018-01-15 21:27           ` Adonay Felipe Nogueira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2o9u9ot33.fsf@xuchunyang.me \
    --to=mail@xuchunyang.me \
    --cc=emacs-orgmode@gnu.org \
    --cc=moptop99@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).