Difference between revisions of "Nikola"

From WikEmacs
Jump to navigation Jump to search
(god damn it, org2nikola does exist !)
(nikola.el)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
'''Nikola''' is a static site generator, written in Python. It natively supports RestructuredText or Markdown, and it is also possible to write with orgmode thanks to a plugin.
 
'''Nikola''' is a static site generator, written in Python. It natively supports RestructuredText or Markdown, and it is also possible to write with orgmode thanks to a plugin.
 +
 +
= Nikola.el =
 +
 +
[https://git.daemons.cf/drymer/nikola.el Nikola.el] is a wrapper around Nikola commands, allowing to create posts, run or publish your site from emacs.
 +
 +
To write with org-mode, we still need org2nikola (see below).
  
 
= Install nikola's org plugin =
 
= Install nikola's org plugin =
  
Once you have [http://getnikola.com/  setup your Nikola site], install the plugin with "nikola plugin -i orgmode" and add this in your config.py:
+
Once you have [http://getnikola.com/  setup your Nikola site], install the plugin with  
 +
 
 +
    nikola plugin -i orgmode
 +
 
 +
and add this in your config.py:
  
 
     # Add the orgmode compiler to your COMPILERS dict.
 
     # Add the orgmode compiler to your COMPILERS dict.
Line 31: Line 41:
 
'''org2nikola''' ([https://github.com/redguardtoo/org2nikola github]) is a little package (much inspired by [[org2blog]]) that allows to post a subtree from within your org file.
 
'''org2nikola''' ([https://github.com/redguardtoo/org2nikola github]) is a little package (much inspired by [[org2blog]]) that allows to post a subtree from within your org file.
  
Install it with packages.el (via [[MELPA]]), put the cursor in the subtree you want to publish and call '''M-x org2nikola-export-subtree'''. It is the only command currently available.
+
Install it with packages.el (via [[MELPA]]), put the cursor in the subtree you want to publish and call '''M-x org2nikola-export-subtree'''. It is the only command currently available. A drawback is that it publishes the post as html with a ".wp" extension, not in the org format (which is good for people coming from wordpress).
 +
 
 +
Other utilities are [https://gitlab.com/emacs-stuff/my-elisp/blob/master/nikola.el in development]. The command {{Command|nikola-post-subtree}} will ask for missing properties and publish the post, keeping the org format. You also have {{Command|nikola-set-post-properties}} to interactively set the required properties (title, description, date, tags).
  
 
[[Category:Blog]]
 
[[Category:Blog]]

Latest revision as of 13:50, 21 February 2017

Nikola is a static site generator, written in Python. It natively supports RestructuredText or Markdown, and it is also possible to write with orgmode thanks to a plugin.

Nikola.el

Nikola.el is a wrapper around Nikola commands, allowing to create posts, run or publish your site from emacs.

To write with org-mode, we still need org2nikola (see below).

Install nikola's org plugin

Once you have setup your Nikola site, install the plugin with

    nikola plugin -i orgmode
and add this in your config.py:
   # Add the orgmode compiler to your COMPILERS dict.
   COMPILERS["orgmode"] = ('.org',)
   # Add org files to your POSTS, PAGES
   POSTS = POSTS + (("posts/*.org", "posts", "post.tmpl"),)
   PAGES = PAGES + (("stories/*.org", "posts", "post.tmpl"),)

Blog from orgmode

Now add Nikola's header in a comment block at the top of your new post:

   #+BEGIN_COMMENT 
   .. title: a title
   .. slug: a-title
   .. date: 2014-08-07 10:57:15 UTC-04:00 
   .. tags: one, two
   .. link: 
   .. description: 
   .. type: text 
   #+END_COMMENT

You can now write a blog post using orgmode and Nikola.

Leverage the work with org2nikola

org2nikola (github) is a little package (much inspired by org2blog) that allows to post a subtree from within your org file.

Install it with packages.el (via MELPA), put the cursor in the subtree you want to publish and call M-x org2nikola-export-subtree. It is the only command currently available. A drawback is that it publishes the post as html with a ".wp" extension, not in the org format (which is good for people coming from wordpress).

Other utilities are in development. The command M-x nikola-post-subtree will ask for missing properties and publish the post, keeping the org format. You also have M-x nikola-set-post-properties to interactively set the required properties (title, description, date, tags).