Skip to content

Commit 924aa5c

Browse files
author
Hua Li
committed
init commit
0 parents  commit 924aa5c

File tree

6 files changed

+166
-0
lines changed

6 files changed

+166
-0
lines changed

archetypes/default.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: "{{ replace .Name "-" " " | title }}"
3+
date: {{ .Date }}
4+
draft: true
5+
---
6+

config.toml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
baseURL = "https://example.com"
2+
languageCode = "en-us"
3+
title = "Ramblings from Neo"
4+
themesDir = "themes"
5+
theme = "m10c"
6+
paginate = 5
7+
enableRobotsTXT = true
8+
googleAnalytics = ""
9+
disqusShortname = ""
10+
11+
[params]
12+
author = "Thomas A. Anderson"
13+
description = "Thoughts the behavior and intelligence of human and computer "
14+
#[[params.social]]
15+
# name = "github"
16+
# url = "https://github.com/gohugoio"
17+
#[[params.social]]
18+
# name = "twitter"
19+
# url = "https://twitter.com/gohugoio"
20+
21+
# Brown theme
22+
#[params.style]
23+
# darkestColor = "#463625"
24+
# darkColor = "#2a3738"
25+
# primaryColor = "#eeee6a"
26+
# lightColor = "#96a879"
27+
# lightestColor = "#ffffff"
28+
29+
# Green theme
30+
#[params.style]
31+
# darkestColor = "#315659"
32+
# darkColor = "#253031"
33+
# primaryColor = "#dad865"
34+
# lightColor = "#96a879"
35+
# lightestColor = "#fff"
36+
37+
# Red and black theme
38+
#[params.style]
39+
# darkestColor = "#d35050"
40+
# darkColor = "#212121"
41+
# primaryColor = "#ffffff"
42+
# lightColor = "#a2a2a2"
43+
# lightestColor = "#d3d3d3"

content/post/github_hugo_netlify.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
title: "How to blog using github,hugo, netlify"
3+
date: 2019-05-19T12:22:19-07:00
4+
draft: false
5+
---
6+
7+
I am late, very late, to the game of blogging. But, any way, I start to have something to say. Inspired by posts [https://blog.omerh.me/post/2019/05/17/first_post/, ], I decided to get it going.
8+
9+
# Main idea
10+
- github: to host and track revision of contents
11+
- hugo: static content generator
12+
- written in go
13+
- high performance (read: fast)
14+
- CLI friendly
15+
- netlify: content distribution network (CDN)
16+
17+
This setup gives us great flexibility, comparing to other managed such as wordpress or medium [ref]
18+
19+
# Set up
20+
## Hugo
21+
### Install hugo and setup a new site
22+
Since I am on Mac, brew is the easiest way to go
23+
```bash
24+
brew install hugo
25+
hugo new site [path]
26+
```
27+
28+
29+
### Download a theme
30+
Go to https://themes.gohugo.io/ and pick one. I picked m10c
31+
32+
```bash
33+
cd [path]
34+
git submodule add https://github.com/vaga/hugo-theme-m10c.git themes/m10c
35+
36+
#directly clone
37+
#git clone https://github.com/vaga/hugo-theme-m10c.git themes/m10c
38+
#
39+
```
40+
41+
### Bootstrap config.toml
42+
```bash
43+
cp themes/m10c/exampleSite/config.toml .
44+
```
45+
46+
Update copied `config.toml`, pay attention to `themeDir` and `theme`
47+
```toml
48+
baseURL = "https://example.com"
49+
title = "Ramblings from Neo"
50+
themesDir = "themes"
51+
theme = "m10c"
52+
paginate = 5
53+
54+
languageCode = "en-us"
55+
enableRobotsTXT = true
56+
googleAnalytics = ""
57+
disqusShortname = ""
58+
59+
[params]
60+
author = "Thomas A. Anderson"
61+
description = "Thoughts on behavior and intelligence of human and computer"
62+
63+
```
64+
65+
### Test out
66+
```bash
67+
hugo server
68+
```
69+
70+
Checkout your how your blog looks like at localhost:1313
71+
72+
73+
## github
74+
### Create a repo in github
75+
{{< figure src="/img/new_github_repo.png" height="120" >}}
76+
77+
You will get a `[git_repo_url]` e.g. `https://github.com/tesla3/blog.git`
78+
79+
### initiate local repo, setup upstream, push local repo to remote
80+
```bash
81+
cd [path]
82+
git init
83+
git add *
84+
git commit -m "init commit"
85+
#now master branch is created
86+
87+
#setup upstream
88+
git remote add origin [git_repo_url]
89+
#e.g.
90+
#git remote add origin https://github.com/tesla3/blog.git
91+
92+
git push
93+
```
94+
95+
96+
## Connect netlify to your github repo
97+
98+
### Flow [step-by-step](https://medium.com/the-codelog/how-to-deploy-a-website-to-netlify-35274f478144)
99+
100+
It is pretty straightforward. Only things specific to hugo: at step of "Basic build setting", put **hugo** in **Build command** and **public/** in **Publish directory**
101+
102+
{{< figure src="/img/netlify_hugo_build_setting.png" height="360" >}}
103+
104+
* Note: it seems netlify figures out by itself the repo is a hugo, so both build command and publish directory is auto filled if you have pushed hugo repo to github before linking netlify to your github
105+
106+
### Now whenever you push to your git repo master branch, netlify will rebuild and publish the site for you.
107+
108+
Here is how you can check your **deploy** status from netlify
109+
110+
{{< figure src="/img/netlify_deploy.png" height="360" >}}
111+
112+
113+
114+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*{box-sizing:border-box}html{line-height:1.6}body{margin:0;font-family:sans-serif;background:#353b43;color:#afbac4}h1,h2,h3,h4,h5,h6{color:#fff}a{color:#57cc8a;text-decoration:none}a:hover{color:#fff;transition:color .8s}pre{overflow:auto}.app-header{padding:2.5em;background:#242930;text-align:center}.app-header-avatar{max-width:15rem;max-height:15rem;border-radius:100%;border:.5rem solid #57cc8a}.app-container{padding:2.5rem}.app-header-social{font-size:2em;color:#fff}.app-header-social a{margin:0 .1em}@media(min-width:940px){.app-header{position:fixed;top:0;left:0;width:20rem;min-height:100vh}.app-container{max-width:65rem;margin-left:20rem}}.error-404{text-align:center}.error-404-title{text-transform:uppercase}.icon{display:block-inline;width:1em;height:1em;vertical-align:-.125em}.pagination{display:block;list-style:none;padding:0;font-size:.8em;text-align:center;margin:3em 0}.page-item{display:inline-block}.page-item .page-link{display:block;padding:.285em .8em}.page-item.active .page-link{color:#fff;border-radius:2em;background:#57cc8a}.post-title{color:#fff}.post-content pre{border-left:.4em solid rgba(87,204,138,.8);padding-left:1em}.post-meta{font-size:.8em}.posts-list{padding:0}.posts-list-item{list-style:none;border-bottom:1px dashed rgba(255,255,255,.3);padding:.4em 0}.posts-list-item-description{display:block;font-size:.8em}.tag{display:inline-block;margin-right:.2em;padding:0 .6em;font-size:.9em;border-radius:.2em;white-space:nowrap;background:rgba(255,255,255,.1);transition:background .8s}.tag:hover{background:rgba(255,255,255,.3)}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"Target":"css/main.min.f90f5edd436ec7b74ad05479a05705770306911f721193e7845948fb07fe1335.css","MediaType":"text/css","Data":{"Integrity":"sha256-+Q9e3UNux7dK0FR5oFcFdwMGkR9yEZPnhFlI+wf+EzU="}}

themes/m10c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 2e997de02000d1bc8277bfe0b97f4a27c2d13feb

0 commit comments

Comments
 (0)