Ghost is a minimalistic blogging platform that is very easy to set up. You can use it as your GitHub user page using a tool called buster.
My current GitHub pages are set up using Octopress, both Ghost and Octopress have their advantages and disadvantages. Every time I’m making a new post using Octopress, I have to go to some online markdown editor to write my post. Whereas Ghost has its inbuilt markdown editor where you can preview your changes as you type. That can be a little annoying. Even though my current setup still uses Octopress, I am editing this markdown using Ghost. One disadvantage of Ghost is that it stores all my blog posts in a local sqlite db, whereas in Octopress, I can see my markdown files and edit and commit changes to the main repository.
3 Steps
- Set up Ghost Blog
- Generate Static Content using Buster
- Gotchas.
Setting up Ghost
- Download Ghost from here.
- Install npm dependencies.
- npm start to run it on your local machine port 2368.
- Click here to register a new user and start posting new blog posts.
- If you want, you can download additional themes into /content/themes folder and change the theme in your Ghost settings.
> npm install
> npm start
Generating Static Pages from your Ghost blog using Buster.
- You need wget for the buster python package to work.
- Download and install wget and its dependencies from here.
- Install libintl-2, libiconv-2, openssl along with wget as given at the end of the wget download page.
- You can install buster using pip, and can use buster directly from the command line, but you are likely to face problems if you are using Windows. Instead you can just clone the buster repo and use the buster.py directly.
> pip install buster
> buster setup --gh-repo=<repo-url>
> buster generate --domain=http://localhost:2368
or
> git clone http://github.com/axitkhurana/buster
> cd buster
> python buster/buster.py setup --gh-repo=<repo-url>
> python buster/buster.py generate --domain=http://localhost:2386
- setup argument will ask you for the GitHub repo of your userpage and create a directory named static
- generate argument will recursively download all the static files of a given url into static folder.
- preview argument will start a simple python webserver and host the static files in your static folder on your local machine port 9000, so that you can preview the static files generated by your previous command.
- deploy will push changes to your GitHub repository
Gotchas
- wget has some problems downloading a webpage using generate command because of \\ slashes so remove those according to this commit.
- When previewing the static site generated, .css and .js using python’s SimpleHttpServer, the MIME type is changed to application/octet-stream. In order to fix this we have an additional class named ExtHandler that extends SimpleHttpRequestHandler to change the default get_type() behaviour.
- This commit has both of the above changes.
- If you are on Windows, I recommend cloning this fork of buster instead of the original, that has both of the above fixes.
- Some static files aren’t downloaded using the generate command, my understanding is that the static files that are requested from javascript or fonts requested using css aren’t generated. You are better off copying the static files and images that aren’t in your static folder directly.
Summary
## download ghost
> cd ghost
> npm install
> npm start
## ghost blog is in http://localhost:2368
## admin/settings in http://localhost:2368/ghost
## change to another directory where you want your generated static website to reside
> git clone https://github.com/syllogismos/buster
> cd buster
> python buster/buster.py setup
## give your github page repository, it creates a static dir
> python buster/buster.py generate --domain=http://localhost:2368
## downloads all the static files into your static dir
> python buster/buster.py preview
## to see your downloaded static files are proper
## If you see any of the static files missing, say fonts or images, just copy them from your ghost directory
## make sure your generated static files look okay
> python buster/buster.py deploy # to commit your changes to the github repo
Thank you.