Using Jekyll and GithubPages to build your own blog [macOS]

Table of Contents

<a id="1"></a>Introduction

GithubPages is now a easy way to build a website for you and your project. The code of your website is stored in the Github so it is convenient for you to edit and push your posts.

Jekyll is a tool for building GithubPages, which is also simple and easy to understand.

My blog, this website, is build using Jekll and GithubPages. You can get its original code from here.

Now let's strat building your own blog. The following guideline is in macOS environment.

<a id="2"></a>Method

<a id="21"></a>Step One

You should have an account in Github and create a new repository base on your github username. Here is the guideline in GithubPages website. The name of your repository maybe your-username.github.io. Make sure the name is correct. Then in the repository's setting page:

image
image

You can see:

image
image

Here you can launch automatic page generator to generate your site quickly. But in this circumstance you don't need to, because we are going to build website using jekyll.

After creating the repository, your should clone it to your mac. I suggest your using Github Desktop to do it.

<a id="22"></a>Step Two

In Terminal, using the following code to install jekyll:

$ gem install jekyll

If your have enabled password in you mac. You may use this instead:

$ sudo gem install jekyll

<a id="23"></a>Step Three

After installing jekyll, you can download some jekyll template from Jekyll Theme and choose the one your like most. And copy all the files in the folder to the repository folder your create in Step One:

image
image

Now run Terminal in your repository folder:

$ cd your repository folder

Run jekyll serve:

$ jekyll serve

In this step, due to the template your choose, you may need to install some other jekyll gems. Just follow the guide in terminal.

After jekyll serve successfully, a website will run in http://localhost:4000/ by default for developing.

<a id="24"></a>Step Four

Until now, the blog has been built. You can commit the change to master of your repository and visit your blog at url such as your-username.github.io.

But this is not the end, it's time to add things to your blog.

Basically, to add a post to your blog, you can write a post in Markdown grammar and put it in the _posts folder in your repository:

image
image

For more information about the files and folders in a jekyll template, you can read documents here.

<a id="3"></a>Ending

There are lots of things you can do with the jekyll template such as adding google analytics, disqus supporting and so on. We will discuss them in the future posts. Here we just talk about the base of building a blog. It's easy only if your have done it. Hope you enjoy it.

My Github:LinShiwei (Lin Shiwei) · GitHub

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末洲赵,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子兵志,更是在濱河造成了極大的恐慌柏靶,老刑警劉巖,帶你破解...
    沈念sama閱讀 217,657評論 6 505
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件溜哮,死亡現(xiàn)場離奇詭異滔金,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)茂嗓,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,889評論 3 394
  • 文/潘曉璐 我一進(jìn)店門餐茵,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人述吸,你說我怎么就攤上這事忿族。” “怎么了蝌矛?”我有些...
    開封第一講書人閱讀 164,057評論 0 354
  • 文/不壞的土叔 我叫張陵道批,是天一觀的道長。 經(jīng)常有香客問我入撒,道長隆豹,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,509評論 1 293
  • 正文 為了忘掉前任茅逮,我火速辦了婚禮璃赡,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘献雅。我一直安慰自己碉考,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,562評論 6 392
  • 文/花漫 我一把揭開白布挺身。 她就那樣靜靜地躺著侯谁,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上良蒸,一...
    開封第一講書人閱讀 51,443評論 1 302
  • 那天技扼,我揣著相機(jī)與錄音,去河邊找鬼嫩痰。 笑死剿吻,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的串纺。 我是一名探鬼主播丽旅,決...
    沈念sama閱讀 40,251評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼纺棺!你這毒婦竟也來了榄笙?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,129評論 0 276
  • 序言:老撾萬榮一對情侶失蹤祷蝌,失蹤者是張志新(化名)和其女友劉穎茅撞,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體巨朦,經(jīng)...
    沈念sama閱讀 45,561評論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡米丘,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,779評論 3 335
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了糊啡。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片拄查。...
    茶點(diǎn)故事閱讀 39,902評論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖棚蓄,靈堂內(nèi)的尸體忽然破棺而出堕扶,到底是詐尸還是另有隱情,我是刑警寧澤梭依,帶...
    沈念sama閱讀 35,621評論 5 345
  • 正文 年R本政府宣布稍算,位于F島的核電站,受9級特大地震影響役拴,放射性物質(zhì)發(fā)生泄漏糊探。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,220評論 3 328
  • 文/蒙蒙 一扎狱、第九天 我趴在偏房一處隱蔽的房頂上張望侧到。 院中可真熱鬧勃教,春花似錦淤击、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,838評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至,卻和暖如春印机,著一層夾襖步出監(jiān)牢的瞬間矢腻,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 32,971評論 1 269
  • 我被黑心中介騙來泰國打工射赛, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留多柑,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 48,025評論 2 370
  • 正文 我出身青樓楣责,卻偏偏與公主長得像竣灌,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個(gè)殘疾皇子秆麸,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,843評論 2 354

推薦閱讀更多精彩內(nèi)容