原文日期:2018-04-19
Remark
Because of the blog of github io is simple and easy, so I am planning use the github io to replace my blog site. Now write the article to record the step of crete github blog, For more infomation, as below.
Steps
A. Create a simple github blog
-
Create a repository on github Create a new repository on github,and the repository's name have a fixed rule. For example,
yourgithubname.github.io. this step is simple. -
To add the index page Create a index.html file on the repository ,and add
hello worldto the file. Now when you inputhttps://yourgithubname.github.ioin the browser, it showhello world. In the end, congratulation to you. -
Replace your blog theme
- Find your repository and click on the
Settingstab. - Scroll down to the
Github Pagessection, click on theChoose a themebutton. - Pick a theme by you like, and click
finishbutton.
tip:For more information, see: github pages site
B. Use jekyll on the blog,and local develoment
- Config Ruby environment and install jekyll.
- Download ruby installer with devkit 2.4.4.1
- Install the ruby, and config ruby environment variable.
- Install jekyll. execute
gem install jekyllcommand.
- Create a blog by jekyll execute follow command.
$ jekyll new blog
Now, you will found a blog directory in current directory. and the blog directory contains some files and a _posts directory, the _posts directory is used place the article.
About more information of jekyll directory and files: see jekyll directory.
-
Copy the files to repository. copy the files of blog to the repository directory and push it to the github repository.
-
Add article
The new article must written the directory by named_posts. For more information about article, you can see: jekyll article. -
Start jekyll
$ jekyll serve
tip:For more information: see jekyll site.
also see jekyll/liquid api document
C. Use your domain on the blog (Not Must)
- Add a domain resolve on your DNS provider.
- Add CNAME file to your repository, and write the domain on it.
- Add your custom to your Github Pages site.
Now, you can use your domain to access.
D. Use Paginate in your site
- At first, write it on the _config.yml file, as below
paginate: 5
plugins:
- jekyll-paginate
- add jekyll-paginate plugin on the Gemfile, as below
gem "jekyll-paginate"
-
If needed, update name of the index.md file to index.html. and it is a requirement of jekyll.
-
install jekyll-paginate plugin
gem install jekyll-paginate
- Update the content of index.html file(show the pagination article). For example,as below
- add the pagination link infomation to index.html file. For example,as below
Now, to visit your site, you will look the pagination effect.