About Me:
skeleton9@weibo/wechat/github/stackoverflow
Software Developer at Beijing, China
This site is for me to track my learning of the programming language swift
from Apple.
I used to be a web application developer, and is familiar with RoR, NodeJS, Python, MySQL, etc. Just starting with the mobile industry :)
About This Site:
- Github Pages:
This site is served on Github as Project Pages.
- Create a repository on github or using your existing repository
- Create a branch
gh-pages
for it - Then you can host your static site on
gh-pages
branch.
There are other kinds pages as User Pages, and Organization Pages. See help on Github.
- Jekyll
This site is build with Jekyll, which helps you to transform plain text to static website. It is officially supported by Github. See https://help.github.com/articles/using-jekyll-with-pages/
Unfortunately, Github do not allow Jekyll plugins for security reasons. So I have added some rake tasks as workaround to make my plugins works.
I write a plugin as _plugins/tag_posts.rb
, which generates list of posts of
tags, so you can visit /tags/code.html
to get all posts with the tag code
.
To make it work, the rake command build
will generate files in _site
as
normal, and copy the _site/tags/*
to tags/*
, which will be copied back on
Github by Jekyll.
- Useful Tips:
rake post title='your title'
to create a new post in _posts
.
Accepted params are:
- title: e.g. title='new to swift'
- tags: e.g. tags='code,algorithm'
- date: e.g. date='2014-01-01'
rake draft title='your title'
to create a new draf in _drafs
. Drafts will
not appear on your posts list on Github.
rake publish title='part of title'
will convert an existing draf to a post.
It will find the matched draf and ask you to select the right one.
rake run
to run locally, including drafts, and you can preview your site at
http://127.0.0.1:4000
rake build
to generate the site static files into _site
, it will also copy
_site/tags
to tags
to make the tag_posts
plugin work. Most of the time
you do not need to run this.
rake commit m='your commit message'
to commit all your changes, which will
automatically run rake build
for you, so files generated by your plugins will
be included.
rake deploy
to push your changes to github. If you have
uncommitted changes, this will automatically commit for you. You can set commit
message by adding m='your commit message'
part, otherwise it will use the
default commit message. It is safe if there is nothing to commit.
So the basic flow for you to write a post is:
rake post title='hello world'
to create a post with title "hello world"- Then you find the file under
_posts
and edit it rake run
to preview it locally athttp://127.0.0.1:4000
rake deploy m='new post hello world'
to commit and push the changes to Github