Total Pageviews

Wednesday 25 January 2017

搭建基于haskell的静态博客程序dpwright.github.com

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

cd /usr/local
git clone --branch source https://github.com/dpwright/dpwright.github.com
cd  dpwright.github.com

root@AR:/usr/local/dpwright.github.com# ls
README.md  cabal.sandbox.config  pending-posts    static
Setup.hs   css             posts        templates
default.nix         slides        wright-access.cabal
pages       
root@AR:/usr/local/dpwright.github.com#
root@AR:/usr/local/dpwright.github.com# stack init --solver
(因为存在cabal文件,所以可运行stack init命令来生成stack.yaml文件。如果生成失败,则加上参数
--solver ,最终成功生成了stack.yaml)
root@AR:/usr/local/dpwright.github.com# stack build
it shows:
...
Linking .stack-work/dist/i386-linux/Cabal-1.18.1.5/build/site/site ...
                
Warning: The following modules should be added to exposed-modules or other-modules in /usr/local/dpwright.github.com/wright-access.cabal:
    - In site component:
        Crossposting
        ElasticTabstops
        Feed
        Indexing
        OutdatedURLs
        Posts
        Slides

Missing modules in the cabal file are likely to cause undefined reference errors from the linker, along with other problems.
wright-access-0.1.0.0: copy/register
Installing executable(s) in
/usr/local/dpwright.github.com/.stack-work/install/i386-linux/lts-2.22/7.8.4/bin
Completed 128 action(s).
root@AR:/usr/local/dpwright.github.com# .stack-work/dist/i386-linux/Cabal-1.18.1.5/build/site/site build
root@AR:/usr/local/dpwright.github.com# ls
README.md  cabal.sandbox.config  pending-posts    static
Setup.hs   css             posts        templates
_cache       default.nix         slides        wright-access.cabal
_site       pages         stack.yaml
root@AR:/usr/local/dpwright.github.com# cd _site
root@AR:/usr/local/dpwright.github.com/_site# ls
CNAME       atom.xml  fonts        index.html  pending-posts  slides
README.md  css         fractured-kingdom    pages        posts       tags
root@AR:/usr/local/dpwright.github.com/_site#
(可见/usr/local/dpwright.github.com/_site就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/dpwright.github.com/_site# cd ../posts
root@AR:/usr/local/dpwright.github.com/posts# nano 2017-01-25-test-1.md
root@AR:/usr/local/dpwright.github.com/posts# cat 2017-01-25-test-1.md
---
date: 2017-01-25 19:25:27
tags: misc1, misc2, misc3
title: 测试1
---

这是测试1.

看看如何?

root@AR:/usr/local/dpwright.github.com/posts# cd ..
root@AR:/usr/local/dpwright.github.com# .stack-work/dist/i386-linux/Cabal-1.18.1.5/build/site/site rebuild

演示网站:http://dgc.bright.biz.st, http://dpwright.com/tags/hakyll/
项目地址:https://github.com/dpwright/dpwright.github.com/tree/source

No comments:

Post a Comment