Total Pageviews

Tuesday 18 February 2014

在linux vps上安装基于nodejs的静态博客程序-akashacms

 2017-1-2日更新。

npm install -g akashacms-cli
cd /usr/local
git clone https://github.com/akashacms/akashacms-website (这一次的例子里,已发表的帖子会自动出现在首页。不过我用mac上的浏览器safari,firefox,chrome进行浏览,都不能显示最新创建的帖子。用iphone手机上的浏览器进行浏览,倒是显示了最新创建的帖子。)
cd akashacms-website

root@AR:/usr/local/akashacms-website# ls
assets       documents  Gruntfile.js  LICENSE      partials
config.js  filez      layouts        package.json    README.md
root@AR:/usr/local/akashacms-website# npm install
root@AR:/usr/local/akashacms-website# akashacms build (这个就是生成/更新静态网站的命令)
root@AR:/usr/local/akashacms-website# ls
assets       documents  Gruntfile.js  LICENSE      out        partials
config.js  filez      layouts        node_modules  package.json    README.md
(生成了out目录)
root@AR:/usr/local/akashacms-website# cd out
root@AR:/usr/local/akashacms-website/out# ls
about.html            deployment      journal.min.css  readable.min.css
akashaepub-guide-cover.jpg  documents      layout       sitemap.xml
akashaepub-logo.jpg        howto      logo.gif       style.css
bootstrap3            img          metatags.html    theming
command-line            index.html      news           vendor
configuration            install.html  plugins       video.css
root@AR:/usr/local/akashacms-website/out#
(可见 /usr/local/akashacms-website/out就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/akashacms-website/out# cd ..
root@AR:/usr/local/akashacms-website# cd documents
root@AR:/usr/local/akashacms-website/documents#
root@AR:/usr/local/akashacms-website/documents# cd news
root@AR:/usr/local/akashacms-website/documents/news# ls
2015  index.html.md
root@AR:/usr/local/akashacms-website/documents/news# mkdir 2017
root@AR:/usr/local/akashacms-website/documents/news# cd 2017
root@AR:/usr/local/akashacms-website/documents/news/2017# nano index.html.md
root@AR:/usr/local/akashacms-website/documents/news/2017# cat index.html.md
---
layout: index-page.html.ejs
title: AkashaCMS News and Announcements for 2017
---

root@AR:/usr/local/akashacms-website/documents/news/2017# mkdir 01
root@AR:/usr/local/akashacms-website/documents/news/2017# cd 01
root@AR:/usr/local/akashacms-website/documents/news/2017/01# nano test-1.html.md
root@AR:/usr/local/akashacms-website/documents/news/2017/01# cat test-1.html.md
---
layout: blog.html.ejs
title: 测试1
publicationDate: January 2, 2017
blogtag: news
teaser: 点击标题,看全文
---

这是测试1.

看看如何

root@AR:/usr/local/akashacms-website/documents/news/2017/01# ls
test-1.html.md    uchinese-economy.html.md  vcprosperity-and-ants.html.md
test-2.html.md    vbcoz-i-love-u.html.md
root@AR:/usr/local/akashacms-website/documents/news/2017/01#
root@AR:/usr/local/akashacms-website/documents/news/2017/01# cd /usr/local/akashacms-website
root@AR:/usr/local/akashacms-website#  akashacms build

演示网站:http://aks.bright.biz.st/news
项目地址:
https://github.com/akashacms/akashacms
https://github.com/akashacms/akashacms-website


cd /usr/local
git clone https://github.com/akashacms/akashacms-blog-skeleton
cd akashacms-blog-skeleton
root@AR:/usr/local/akashacms-blog-skeleton# akashacms build
root@AR:/usr/local/akashacms-blog-skeleton# ls
assets       documents  node_modules  package.json  README.md
config.js  layouts    out        partials
root@AR:/usr/local/akashacms-blog-skeleton# cd out
root@AR:/usr/local/akashacms-blog-skeleton/out# ls
2015  bootstrap3  css  img  index.html    rss.xml  sitemap.xml  vendor
root@AR:/usr/local/akashacms-blog-skeleton/out#
(可见/usr/local/akashacms-blog-skeleton/out就是静态网站的根目录)

新建源帖:
root@AR:/usr/local/akashacms-blog-skeleton/out# cd ..
root@AR:/usr/local/akashacms-blog-skeleton#
root@AR:/usr/local/akashacms-blog-skeleton# cd documents
root@AR:/usr/local/akashacms-blog-skeleton/documents# ls
2015  index.html.md
root@AR:/usr/local/akashacms-blog-skeleton/documents# cd 2015
root@AR:/usr/local/akashacms-blog-skeleton/documents/2015# ls
root@AR:/usr/local/akashacms-blog-skeleton/documents/2015# cd 11
root@AR:/usr/local/akashacms-blog-skeleton/documents/2015/11# nano test-post-3.html.md
root@AR:/usr/local/akashacms-blog-skeleton/documents/2015/11# cat test-post-3.html.md
---
layout: blog.html.ejs
title: 测试3
publicationDate: November 27, 2015
blogtag: news
teaser: This is a blog teaser
---

这是测试3.

看看如何?

root@AR:/usr/local/akashacms-blog-skeleton/documents/2015/11# cd /usr/local/akashacms-blog-skeleton
root@AR:/usr/local/akashacms-blog-skeleton# akashacms build

演示网站:http://aks-blog.bright.biz.st/
项目地址:
https://github.com/akashacms/akashacms
https://github.com/akashacms/akashacms-blog-skeleton
--------------

npm install -g akashacms-cli
akashacms init akashacms-site
cd akashacms-site

as3:~/akashacms-site# ls
assets config.js layouts partials
build.js documents package.json README.md
as3:~/akashacms-site# npm install
as3:~/akashacms-site# akashacms build (这个就是生成/更新静态网站的命令)
as3:~/akashacms-site# ls
assets    config.js  layouts       out           partials
build.js  documents  node_modules  package.json  README.md
(新出现了out目录)
as3:~/akashacms-site# cd out
as3:~/akashacms-site/out# ls
asynchronous.html     index.html         syncpartial.html 
bootstrap             markdown.html      vendor
bootstrap3            sitemap.xml        video.css
as3:~/akashacms-site/out#
可见~/akashacms-site/out/就是静态网站的根目录。
as3:~/akashacms-site/out# nohup Rwebserver 34751 > /dev/null &
访问http://as3.brite.biz:34751就可看到网站效果。



发贴方法:
as3:~/akashacms-site/out# cd ..
as3:~/akashacms-site# ls
assets    config.js  layouts       out           partials
build.js  documents  node_modules  package.json  README.md
as3:~/akashacms-site# cd documents
as3:~/akashacms-site/documents# ls
asynchronous.html.kernel  markdown.html.md       
index.html.ejs            syncpartial.html.ejs
as3:~/akashacms-site/documents# nano test1.html.ejs
按index.html.ejs或syncpartial.html.ejs的内容格式,新建帖子test1.html.ejs,格式如下:
---
layout: default.html.ejs
title: test1
---

这是测试1.

然后,
as3:~/akashacms-site/documents# cd ..
as3:~/akashacms-site# akashacms build

演示站点:
http://as3.brite.biz:34751,http://aks.briteming.yi.org
项目地址:http://akashacms.com/,http://akashacms.com/install.html

不过已发表的帖子并不会自动出现在首页,可像以前我说过的那样:修改源贴所在目录里的index文件,
这里就是修改index.html.ejs,在<P>Welcome to...这行的上一行加上:
<center><a href=/test1.html>测试1</a></center>
<center><a href=/test2.html>测试2</a></center>
<center><a href=/smiling-face.html>笑脸</a></center>
<center><a href=/chinese-economy.html>中国经济</a></center>
然后返回~/akashacms-site/,运行akashacms build即可。

或者修改~/akashacms-site/layouts/default.html.ejs,在<p>和</p>之间加上所发表文章的超链即可。