How to Setup GitHub Pages?

My Point of View

§ Saturday, August 18, 2018

How to Setup GitHub Pages?

Written by yangby


Last weekend, I tried GitHub Pages.

I’ve tried a lot of online services to build a blog in past several years, such as Google App Engine, Red Hat OpenShift v2, Heroku.

GitHub Pages is more simple than a PaaS, or running a own web server in a VPS. I can focus on the content of my posts.

Create a Repository in GitHub

Since I want to setup a personal site, I just create a repository named USERNAME.github.io.

The I clone the new repository:

git clone https://github.com/USERNAME/USERNAME.github.io

Write a markdown file named index.md, add to the repository, commit, then push to github.

DONE!

Setting Up A Local Jekyll Environment

Change GitHub Pages Themes

More details can found in follow pages:

Activate One of The Officially Supported Themes

There are 13 GitHub Pages Official Supported Themes:

Add a new line to _config.yml, with the theme name:

theme: jekyll-theme-primer

Activate Any Other Open Source Jekyll Theme Hosted on GitHub

Add a new line to _config.yml, with the theme repo:

remote_theme: AUTHOR/REPOSITORY@BRANCH_OR_TAG_OR_COMMIT

Math Support

Add Math Support to Jekyll, just need add a new line to your posts:

<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/VERSION/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>

Samples

When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are \(x = {-b \pm \sqrt{b^2-4ac} \over 2a}.\)

Maxwell’s Equations:

\begin{align} \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}}
\nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}}
\nabla \cdot \vec{\mathbf{B}} & = 0 \end{align}

Customizing GitHub Pages

More details can found in follow pages:


Categories:  github-pages
Tags:  tex