Create a personal blog on GitHub

Source: Internet
Author: User
Tags configuration settings

Step 1: First, let's take a look at the file directory to be created locally.

/jun_demo    |-- _config.yml    |-- _layouts    |   |-- default.html     |-- _posts    |   |-- 2014-06-26-hello-world.html    |-- index.html

Config. yml: configuration settings

_ Layouts: Template storage folder

Default.html: file template

_ Posts: directory for storing blog articles

2014-06-26-hello-world-html: blog article

Index.html: homepage of the article

Step 2: Configuration

// Create the folder jun_demo and perform git Initialization on the directory
$ Mkdir jun_demo
$ CD jun_demo $ git init
//Create a branch GH-pages without a parent node. The website is generated only on pages in the branch.
$ Git checkout -- orphan GH-pages

Step 3:Add content to the file directory created above

1 config. yml (only set this property for other properties see:


2 default.html

<!DOCTYPE html>

3 2014-06-26-hello-world-html (the part between "---" is the blog page settings, where layout is the selection template and title is page. Title)

--- Layout: default title: Hello, world --- <H2 >{{ page. title }}</H2> <p> my first article </P> <p >{{ page. date | date_to_string }}</P>

4 index.html

--- Layout: default title: my blog --- <H2> {page. title }}</H2> <p> latest article </P> <ul> {% for post in site. posts %} <li >{{ post. date | date_to_string }}< a href = "{site. baseurl }{{ post. URL }}" >{{ post. title }}</A> </Li >{% endfor %} </ul>

Step 4:Submit

// Add to local database
$ Git Add. $ git commit-M "First Post"
// Replace username in the service library with your GitHub account name, And jun_demo.git also serves as your repository name on the server.
$ Git remote add origin
$ Git push origin GH-pages

Step 5:Visit your site at (replace username with your username)

Note: This article is the reading summary, the original address is

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.