在Github上部署Ghost

参考网址 [1] TryGhost https://github.com/TryGhost/Ghost/tree/stable

以下操作在Mac环境

Github repo

*建立新的repo,命名规则为 yourname.github.io

本地安装

  • 下载Ghost的发布版本,https://ghost.org/download/

  • 解压至Git分支根目录下的Blog文件夹

  • 命令行下切换至Blog路径,输入npm install –production

  • 依赖包安装完毕之后本地启动 npm start

如果能看到 http://localhost:2368/ 表示启动成功

配置Ghost

配置地址为 http://localhost:2368/ghost
详细配置略

静态化

静态化使用到了Buster这个工具,实际使用中发现了一个Bug,即静态资源文件后面带上了控制文件版本的参数,例如 hi.css?v=2.0 Github环境通过此文件名无法找到文件,需去掉后面的参数部分。Buster代码中有进行fix,在我的环境中不能生效,遂进行了简单fix。
修复后的分支为:https://github.com/copywrite/buster

  • 在Ghost的同级目录fork buster,安装相关的python依赖

  • 在Ghost目录建立static文件夹,或者通过buster setup命令生成

  • buster generate 生成静态文件

  • 将static文件夹中的静态文件拷贝至Ghost根目录

  • 提交Ghost分支

提交

等待片刻后访问 http://yourname.github.io

    原文作者:小朋友
    原文地址: https://segmentfault.com/a/1190000004336989
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞