Total Pageviews

Tuesday 18 March 2014

在linux vps上搭建基于emacs的orgmode的静态博客程序-Homepage

 在操作前,请先看完编译emacs,并安装emacs的org组件
as3:~# mkdir -p ~/Private/Homepage
as3:~# mkdir -p ~/Sites/Privat
as3:~# git clone https://github.com/pharos-alexandria/Homepage
as3:~# mv Homepage/* ~/Private/Homepage/
as3:~# cd ~/Private/Homepage/
as3:~/Private/Homepage#
as3:~/Private/Homepage# ls
Blog      index.org   org.css        Projekte        
emacs.el  preamble.html  sitemap-gen.org  sitemap.org
as3:~/Private/Homepage# cp emacs.el ~/.emacs.el

发贴方法:
as3:~/Private/Homepage# cd Blog
as3:~/Private/Homepage/Blog# nano 2014-03-18-smiling-face.org
按~/Private/Homepage/Blog/里面某个org文件的格式,新建帖子2014-03-18-smiling-face.org,格式如下:
#+TITLE:     2014 03 18 笑脸
#+OPTIONS:   H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t *:t TeX:t author:nil <:t LaTeX:t
#+HTML_HEAD:     <link rel="stylesheet" href="../org.css" type="text/css" />
#+BEGIN_HTML
<h2>笑脸</h2>
<object height="315" width="420"><param name="movie" value="//www.youtube.com/v/oSnEHx-f8ik?hl=zh_CN&amp;version=3"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="//www.youtube.com/v/oSnEHx-f8ik?hl=zh_CN&amp;version=3" type="application/x-shockwave-flash" width="420" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>
#+END_HTML
欣赏一下笑脸。

然后,
as3:~/Private/Homepage/Blog# cd ..
as3:~/Private/Homepage# ls
Blog      index.org   org.css        Projekte         sitemap-gen.org~
emacs.el  index.org~  preamble.html  sitemap-gen.org  sitemap.org
as3:~/Private/Homepage# nano index.org
在此行** [[file:Blog/2013-03-28.org][28.03.2013 | Karte der Teilnehmer an der Synode von Serdika (342)]]的上一行加上:
** [[file:Blog/2014-03-18-smiling-face.org][笑脸]]
然后,
as3:~/Private/Homepage# emacs index.org  (这个就是更新静态网站的命令。上面需先编辑index.org,否则所发表的帖子的超链地址不会出现在首页)
(按alt+x,输入org-publish-project,回车,输入orgweb,回车,可能会出现提示:
Invalid read syntax: "#",没关系,再按alt+x,输入org-publish-project,回车,输入orgweb,回车,等到emacs编辑器里面的文字闪动停止,即可。按ctrl+x ctrl+c退出emacs.)

查看这个地址https://github.com/pharos-alexandria/Homepage/blob/master/emacs.el,可看到这行文字- :base-directory "~/Private/Homepage",
可知~/Private/Homepage/是源贴所在的目录;
看到这行文字-     :publishing-directory "~/Sites/Privat",可知~/Sites/Privat/就是静态网站的根目录。

演示站点:http://pa.brite.biz.st
项目地址:https://github.com/pharos-alexandria/Homepage

相关帖子:
http://briteming.blogspot.com/2014/03/linux-vpsemacsorgmode-bastibe.html
http://briteming.blogspot.com/2014/03/linux-vpsorgmode-misaki-orgmode.html

类似项目:https://github.com/xiaohanyu/org-site