Theme: etch (more themes).
# I installed hugo.
$ brew install hugo
# Then created a new site.
$ cd ~/git/gaastonsr
$ hugo new site blog
# Then installed the theme.
$ cd ~/git/gaastonsr/blog
$ git init
$ git subdmodule add git@github.com:LukasJoswiak/etch.git themes/etch
# Then added the theme to `config.toml`.
$ echo 'theme = "etch"' >> config.toml
# Then added the first blog post.
$ hugo new posts/hello-world.md
# And added an about page.
$ hugo new about/index.md
# Started the server.
$ hugo server -D
Here, are the instructions that I followed.
I created a gaastonsr.github.io
repository, and then added it as a submodule to
this repository.
$ cd ~/git/gaastonsr/blog
$ git submodule add -b master git@github.com:gaastonsr/gaastonsr.github.io.git public
Cloning into '~/git/gaastonsr/blog/public'...
warning: You appear to have cloned an empty repository.
fatal: 'origin/master' is not a commit and a branch 'master' cannot be created from it
Unable to checkout submodule 'public'
An error was returned. To fix that, let's add an empty commit to the repository.
$ cd ~/git/gaastonsr
$ git clone git@github.com:gaastonsr/gaastonsr.github.io.git
$ cd gaastonsr.github.io
$ git commit --allow-empty -m 'Initial commit'
$ git push
Now if I try to add the submodule again, it won't work because the previous
git submodule add
operation had a fatal error and left the submodule in a
dirty state where the submodule wasn't added, that can be verified by checking
that there is not settings for the submodule in .gitmodules
and .git/config
but at the same time the empty repository was copied locally, that can be
verified by checking that git repositories exist at public/.git
and
.git/modules/public
, so some cleanup is needed before the submodule can be
added again.
$ cd ~/git/gaastonsr/blog
# Remove resources created by the previous unsuccesful `git submodule add`.
$ rm -rf public && rm -rf .git/modules/public
$ git submodule add -b master git@github.com:gaastonsr/gaastonsr.github.io.git public
Cloning into '~/git/gaastonsr/blog/public'...
remote: Enumerating objects: 2, done.
remote: Counting objects: 100% (2/2), done.
remote: Total 2 (delta 0), reused 2 (delta 0), pack-reused 0
Receiving objects: 100% (2/2), done.
It worked now, yay!
To automate the process a deploy.sh
script was created.
# Create the script.
$ cd ~/git/gaastonsr/blog
$ touch deploy.sh
# Give it execution permissions.
$ chmod u+x deploy.sh
Add the script shown here. And now ./deploy.sh "Optional commit message"
can
be used to deploy your changes.
Go to the blog settings and under
the "GitHub Pages" section add your domain, in this case wwww.gaston.dev
.
Now go to your DNS provider and set up CNAME
record that points to
gaastonsr.github.io
. In this case CNAME www.gaston.dev -> gaastonsr.github.io
.
- Install hugo:
bew install hugo
(more info). - Install a toml extension for you code editor.
- Start the server:
hugo server -D
. - Create a post:
hugo new posts/hello-world.md
. - Create a page:
hugo new about/index.md
. - Deploy changes:
deploy.sh "Optional commit message"
. Don't forget commiting your changes after deploying.