umiswing

jump to main content

How to blog with Emacs

Intro

When searing "how to build a personal blog" in google, people always tell you to use hugo framework. I try hugo and I don't like it. All I need is just to publish my text shits, not a heavy framework. And I like to control everything in my blog. However, I know little about html and css, and I don't want to spend time on front end development. Org Mode comes to my mind. I'm an emacs guy and I love to blog with emacs. I guess every one tries to blog with Org Mode has read this post. I decide to use weblorg. It's written in elisp so that require no external dependencies. And its sample websites is beautiful.

Weblorg

Read the official manual. I don't know why I can't run the sample in the manual, but we can refer to sample in its source code. Remember to clone templatel and add this in your publish.el:

(add-to-list 'load-path "~/.emacs.d/weblorg")
(add-to-list 'load-path "~/.emacs.d/templatel")
(require 'weblorg)
(setq system-time-locale "C") ;; set this if you want english time stamps in org mode

Run this and emacs will generate html shits in the output dir.

emacs --script publish.el

Apache2

I'm too stupid to know how to build a website. Following is for people who is as stupid as me. To start a html service on your localhost, you must install apache2. Write your config in /etc/apache2.

  1. Read the /etc/apache2/apache2.conf, which is the entry of config.

TL;DR

  1. Search for /var/www, change it to where your weblorg generate html shits.
  2. Edit ports.conf, change the port if you want.
  3. Edit sites-available/000-default.conf, once you open it you should know how to modify it.
  4. Finally, start apache2 using sudo apache2ctl start.

Then, enter localhost:port in your browser, and you will see your blog.