Pages

Monday, 30 January 2017

搭建基于haskell的静态博客程序steshaw.org

先按此文http://briteming.blogspot.jp/2016/07/hakyll.html,安装stack,ghc,hakyll.


cd /usr/local
git clone https://steshaw/steshaw.org
cd  steshaw.org

root@AR:/usr/local/steshaw.org# ghc --make site.hs (此法遇错,于是换用stack build方法)
root@AR:/usr/local/steshaw.org# stack build
会显示:
 ...
Linking .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/site/site ...
                
Warning: The following modules should be added to exposed-modules or other-modules in /usr/local/steshaw.org/steshaw-org.cabal:
    - In site component:
        Abbreviations
        Config
        Multilang
        YFilters

Missing modules in the cabal file are likely to cause undefined reference errors from the linker, along with other problems.
steshaw-org-0.1.0.0: copy/register
Installing executable(s) in
/usr/local/steshaw.org/.stack-work/install/i386-linux/lts-5.15/7.10.3/bin
Completed 131 action(s).
root@AR:/usr/local/steshaw.org# .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/site/site build
(此即生成/更新静态网站的根目录的命令.会生成_site这个子目录)
root@AR:/usr/local/steshaw.org# cd _site
root@AR:/usr/local/steshaw.org/_site# ls
CNAME      drafts               images       posts       talks
about      favicon.ico               index.html  posts.html
atom.xml  google735021a4adca5bd2.html  js       rss.xml
css      ideas                   notes       tags
root@AR:/usr/local/steshaw.org/_site# 
(可见/usr/local/steshaw.org/_site就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/steshaw.org/_site# cd ../posts
root@AR:/usr/local/steshaw.org/posts# nano 2017-01-30-test-1.markdown
root@AR:/usr/local/steshaw.org/posts# cat 2017-01-30-test-1.markdown
---
title: 测试1
tags: misc1, misc2, misc3

date: 2017-01-30 09:57:00
---

这是测试1.

看看如何?

root@AR:/usr/local/steshaw.org/posts# cd ..
root@AR:/usr/local/steshaw.org# .stack-work/dist/i386-linux/Cabal-1.22.5.0/build/site/site build

演示网站:http://ss.bright.biz.st
项目地址:https://steshaw/steshaw.org

No comments:

Post a Comment