
大家中秋快乐!不知道今天还有几个朋友在写代码哈哈,国庆期间试着撸了个静态博客工具 ,基本功能已经好了,欢迎一起交流 : https://github.com/laoqiren/yohe
一个静态博客生成器,采用Node.js开发。Yohe = 哟呵,一个会让你发出”哟呵,不错哦“感叹的静态博客生成器。
线上 demo: http://luoxia.me/yohe_site/
$ npm install yohe -g 获取帮助
$ yohe --help 初始化博客
$ yohe init myblog $ cd myblog 该命令会初始化博客目录,包括初始化主题,文章,自定义页面等目录,以及加载默认配置文件
创建新文章
$ yohe new <postName> 该命令在source/_posts/下新建<postName>.md文件,在这里写作
渲染博客文件
$ yohe build 该命令会渲染博客到public目录
本地预览
$ yohe server 该命令会在本地起一个静态文件服务器,端口,子路径等信息可通过config.json配置
新增自定义页面
$ yohe page <pageName> 该命令会在source/_extra下生成<pageName>.md文件,默认布局为about页面布局
运行yohe init后会生成config.json,配置说明:
{ "basic": { "title": "My Blog", // 博客标题 "author": "laoqiren", // 博客作者 "description": "爱技术,爱生活", // 个性签名 "root": "" // 博客根目录,当博客网站位于子路径如"http://luoxia.me/yohe_site"时,配置为"/yohe_site" }, "theme": { "highlightTheme": "railscasts", // 代码高亮主题,所有可用主题列表参照"https://github.com/isagalaev/highlight.js/tree/master/src/styles" "per_page": 6,//每页展示的文章数 "filter": ["life","随笔"], // 首页过滤分类文章,比如生活随笔文章不显示在首页列表 "navPages": [ // 自定义导航菜单的页面标题和链接 { "title": "标签", "url": "/tags" }, { "title": "关于", "url": "/about" }, { "title": "生活随笔", "url": "/categories/life/" } ] }, "server": { "port": 3000 //本地预览服务器端口 }, "gitment": { // gitment 评论功能相关配置,gitment 使用教程参照” https://github.com/imsun/gitment “ "owner": "", "repo": "", "oauth": { "client_id": "", "client_secret": "" } } } 参照下面的例子:
--- title: Cluster 模块 date: 2016-11-27 tags: [负载均衡,集群,多进程] layout: post comment: true categories: Nodejs --- 其中layout默认为post,comment默认为true
更丰富的配置正在开发中
Yohe最终渲染结果在public目录,可采用多种方式起一个静态文件服务器,将public目录发布。
目前Yohe的主题功能与Yohe耦合,需要修改主题可以对source/_layout和public/assets/进行开发,重新yohe build即可。未来的版本将解耦主题功能。
source/_about/about.mdblog in blog-代替 1 niucang 2017-10-04 16:08:01 +08:00 よほ, not bad~ |
2 acgnsstech 2017-10-04 17:59:18 +08:00 not so good |
3 hrg520 2017-10-04 18:28:53 +08:00 看着不错!! |
4 ChristopherCray 2017-10-04 18:35:33 +08:00 嘿嘿嘿 |
5 xcatliu 2017-10-04 19:52:08 +08:00 via iPhone 哦呼 |
6 luanjia 2017-10-04 20:08:47 +08:00 支持一下! |
7 laoqiren OP 喜欢的话,赏一个 star 支持一下吧~ |
8 17xh2 2017-10-05 05:21:33 +08:00 哟呵,不错哦 |
9 ibuffalo 2017-10-05 09:48:46 +08:00 很不错哟,支持 wordpress 转换吗? |
11 sohu022 2017-10-05 10:48:41 +08:00 via iPhone 相较于 Hexo 等有什么亮点? Hexo 主题和插件生态都那么丰富了 |
12 laoqiren OP @sohu022 1. 更快 2. 集成了一些常见需求,如首页过滤分类文章,打赏功能等 3. 足够简单,项目代码就那么一点,很容易二次开发。4. 其他亮点还需继续努力开发 |
13 laoqiren OP 额,貌似没法修改文章啊 |
14 laoqiren OP 帖子没法修改,最新版本更加完善,感兴趣可以转[https://github.com/laoqiren/yohe]( https://github.com/laoqiren/yohe) |
15 smilefishes36 2017-10-13 11:26:35 +08:00 哈哈哈来试试~ |
16 laoqiren OP 目前 Archives 已经实现,模板变量已经统一,开发主题更方便啦! |